Commit 8fb11c9b authored by Alex Clarke's avatar Alex Clarke Committed by Commit Bot

Fix NativeBrowserTestActivity and multiple onStarts

NativeBrowserTestActivity.onStart will be called twice,
once due to ActivityThread.handleStartActivity and once
due to ActivityThread.handleWindowVisibility which calls
Activity.performRestart.

Usually the tests exit before the task posted by
NativeTest.postTask runs, but if they don't really bad
things happen.

Needed to land the BrowserUIThreadScheduler patch.

Bug: 863341
Change-Id: Iba19248ec2bbdfcd12a2e75f176a4c7e25de2662
Reviewed-on: https://chromium-review.googlesource.com/c/1455997
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629535}
parent 0cae2225
......@@ -26,6 +26,7 @@ public abstract class NativeBrowserTestActivity extends Activity {
};
private NativeTest mTest = new NativeTest();
private boolean mStarted;
@Override
public void onCreate(Bundle savedInstanceState) {
......@@ -39,6 +40,15 @@ public abstract class NativeBrowserTestActivity extends Activity {
@Override
public void onStart() {
// onStart can be called any number of times see:
// https://developer.android.com/guide/components/activities/activity-lifecycle#onstart
// We only want to run the test once (or bad things can happen) so bail out if we've
// already started.
if (mStarted) {
super.onStart();
return;
}
mStarted = true;
deletePrivateDataDirectory();
initializeBrowserProcess();
super.onStart();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment