Commit dd3f4681 authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

android: Further relax LifetimeAssert check

Some N bots are also causing failures from Activities not being
destroyed, just more flakily than on L. Expand the check in
LifetimeAssertRule to all versions.

Bug: 1081250
Change-Id: I3d8330988b8aca47b66084d9bc43b82d0a53b240
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216535Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771988}
parent 83b67653
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
package org.chromium.base.test; package org.chromium.base.test;
import android.os.Build;
import org.junit.rules.TestRule; import org.junit.rules.TestRule;
import org.junit.runner.Description; import org.junit.runner.Description;
import org.junit.runners.model.Statement; import org.junit.runners.model.Statement;
...@@ -31,10 +29,9 @@ public class LifetimeAssertRule implements TestRule { ...@@ -31,10 +29,9 @@ public class LifetimeAssertRule implements TestRule {
private void maybeAssertLifetime() { private void maybeAssertLifetime() {
// There is a bug on L and below that DestroyActivitiesRule does not cause onStop and // There is a bug on L and below that DestroyActivitiesRule does not cause onStop and
// onDestroy. Ignore lifetime asserts if that is the case. // onDestroy. On other versions, DestroyActivitiesRule may still fail flakily. Ignore
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1 // lifetime asserts if that is the case.
&& ApplicationStatus.isInitialized() if (ApplicationStatus.isInitialized() && !ApplicationStatus.isEveryActivityDestroyed()) {
&& !ApplicationStatus.isEveryActivityDestroyed()) {
return; return;
} }
LifetimeAssert.assertAllInstancesDestroyedForTesting(); LifetimeAssert.assertAllInstancesDestroyedForTesting();
......
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