Fix race in catalyst tests

Summary:
Native code accesses the Java Application through the ApplicationHolder. The application should be set on the holder as soon as possible. This change fixes a race in WebWorkersTest.

public

Reviewed By: astreet

Differential Revision: D2905157

fb-gh-sync-id: 7e488f4eecefedb8482276776b3a66e14a843f90
This commit is contained in:
Chris Hopman 2016-02-05 18:09:18 -08:00 committed by facebook-github-bot-2
parent 7cbad9f530
commit 294185ac32

View File

@ -147,7 +147,6 @@ public abstract class ReactIntegrationTestCase extends AndroidTestCase {
mBridgeIdleSignaler = new ReactBridgeIdleSignaler();
mInstance.addBridgeIdleDebugListener(mBridgeIdleSignaler);
getContext().initializeWithInstance(mInstance);
ApplicationHolder.setApplication((Application) getContext().getApplicationContext());
}
public boolean waitForBridgeIdle(long millis) {
@ -165,6 +164,12 @@ public abstract class ReactIntegrationTestCase extends AndroidTestCase {
IDLE_TIMEOUT_MS);
}
@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationHolder.setApplication((Application) getContext().getApplicationContext());
}
@Override
protected void tearDown() throws Exception {
super.tearDown();