8
8
9
9
package com .facebook .react .testing ;
10
10
11
- import javax .annotation .Nullable ;
12
-
13
- import java .util .concurrent .CountDownLatch ;
14
- import java .util .concurrent .TimeUnit ;
15
-
16
11
import android .graphics .Bitmap ;
17
12
import android .os .Bundle ;
18
13
import android .support .v4 .app .FragmentActivity ;
19
14
import android .view .View ;
20
15
import android .view .ViewTreeObserver ;
21
16
import android .widget .FrameLayout ;
22
-
23
17
import com .facebook .infer .annotation .Assertions ;
24
18
import com .facebook .react .ReactInstanceManager ;
25
19
import com .facebook .react .ReactInstanceManagerBuilder ;
31
25
import com .facebook .react .testing .idledetection .ReactBridgeIdleSignaler ;
32
26
import com .facebook .react .testing .idledetection .ReactIdleDetectionUtil ;
33
27
import com .facebook .react .uimanager .UIImplementationProvider ;
28
+ import java .util .concurrent .CountDownLatch ;
29
+ import java .util .concurrent .TimeUnit ;
30
+ import javax .annotation .Nullable ;
34
31
35
32
public class ReactAppTestActivity extends FragmentActivity implements
36
33
DefaultHardwareBackBtnHandler
@@ -39,7 +36,7 @@ public class ReactAppTestActivity extends FragmentActivity implements
39
36
private static final String DEFAULT_BUNDLE_NAME = "AndroidTestBundle.js" ;
40
37
private static final int ROOT_VIEW_ID = 8675309 ;
41
38
// we need a bigger timeout for CI builds because they run on a slow emulator
42
- private static final long IDLE_TIMEOUT_MS = 60000 ;
39
+ private static final long IDLE_TIMEOUT_MS = 120000 ;
43
40
44
41
private CountDownLatch mLayoutEvent = new CountDownLatch (1 );
45
42
private @ Nullable ReactBridgeIdleSignaler mBridgeIdleSignaler ;
@@ -164,16 +161,21 @@ public void loadApp(
164
161
mBridgeIdleSignaler = new ReactBridgeIdleSignaler ();
165
162
166
163
ReactInstanceManagerBuilder builder =
167
- ReactTestHelper .getReactTestFactory ().getReactInstanceManagerBuilder ()
168
- .setApplication (getApplication ())
169
- .setBundleAssetName (bundleName )
164
+ ReactTestHelper .getReactTestFactory ()
165
+ .getReactInstanceManagerBuilder ()
166
+ .setApplication (getApplication ())
167
+ .setBundleAssetName (bundleName );
168
+ if (!spec .getAlternativeReactPackagesForTest ().isEmpty ()) {
169
+ builder .addPackages (spec .getAlternativeReactPackagesForTest ());
170
+ } else {
171
+ builder .addPackage (new MainReactPackage ());
172
+ }
173
+ builder
174
+ .addPackage (new InstanceSpecForTestPackage (spec ))
170
175
// By not setting a JS module name, we force the bundle to be always loaded from
171
176
// assets, not the devserver, even if dev mode is enabled (such as when testing redboxes).
172
177
// This makes sense because we never run the devserver in tests.
173
178
//.setJSMainModuleName()
174
- .addPackage (spec .getAlternativeReactPackageForTest () != null ?
175
- spec .getAlternativeReactPackageForTest () : new MainReactPackage ())
176
- .addPackage (new InstanceSpecForTestPackage (spec ))
177
179
.setUseDeveloperSupport (useDevSupport )
178
180
.setBridgeIdleDebugListener (mBridgeIdleSignaler )
179
181
.setInitialLifecycleState (mLifecycleState )
0 commit comments