Commit f198bc32 authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android] Destroy mSetActivity in ChromeActivityTestRule

This CL destroys mSetActivity in rule teardown. The activity is
launched manually inside the test rule and it is not ended prior to
this change.

This is necessary to avoid crash once we will teardown the
SigninTestUtil properly.

Bug: 1083138
Change-Id: Ibacf4a78c22b5316983a3ae208070c075b042738
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2202796Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770559}
parent 7826691c
...@@ -140,6 +140,10 @@ public class ChromeActivityTestRule<T extends ChromeActivity> extends ActivityTe ...@@ -140,6 +140,10 @@ public class ChromeActivityTestRule<T extends ChromeActivity> extends ActivityTe
@Override @Override
protected void afterActivityFinished() { protected void afterActivityFinished() {
try { try {
if (mSetActivity != null) {
// Destroy the activity launched manually in this test rule.
ApplicationTestUtils.finishActivity(mSetActivity);
}
ApplicationTestUtils.tearDown(InstrumentationRegistry.getTargetContext()); ApplicationTestUtils.tearDown(InstrumentationRegistry.getTargetContext());
Thread.setDefaultUncaughtExceptionHandler(mDefaultUncaughtExceptionHandler); Thread.setDefaultUncaughtExceptionHandler(mDefaultUncaughtExceptionHandler);
} catch (Exception e) { } catch (Exception e) {
......
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