Skip to content

Commit

Permalink
Fix race in catalyst tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cjhopman authored and facebook-github-bot-2 committed Feb 6, 2016
1 parent 7cbad9f commit 294185a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ public void initializeWithInstance(CatalystInstance instance) {
mBridgeIdleSignaler = new ReactBridgeIdleSignaler();
mInstance.addBridgeIdleDebugListener(mBridgeIdleSignaler);
getContext().initializeWithInstance(mInstance);
ApplicationHolder.setApplication((Application) getContext().getApplicationContext());
}

public boolean waitForBridgeIdle(long millis) {
Expand All @@ -165,6 +164,12 @@ public void waitForBridgeAndUIIdle() {
IDLE_TIMEOUT_MS);
}

@Override
protected void setUp() throws Exception {
super.setUp();
ApplicationHolder.setApplication((Application) getContext().getApplicationContext());
}

@Override
protected void tearDown() throws Exception {
super.tearDown();
Expand Down

0 comments on commit 294185a

Please sign in to comment.