Skip to content

Commit

Permalink
android: Further relax LifetimeAssert check
Browse files Browse the repository at this point in the history
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/+/2216535
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771988}
  • Loading branch information
Bo Liu authored and Commit Bot committed May 26, 2020
1 parent 83b6765 commit dd3f468
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

package org.chromium.base.test;

import android.os.Build;

import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
Expand All @@ -31,10 +29,9 @@ public void evaluate() throws Throwable {

private void maybeAssertLifetime() {
// There is a bug on L and below that DestroyActivitiesRule does not cause onStop and
// onDestroy. Ignore lifetime asserts if that is the case.
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1
&& ApplicationStatus.isInitialized()
&& !ApplicationStatus.isEveryActivityDestroyed()) {
// onDestroy. On other versions, DestroyActivitiesRule may still fail flakily. Ignore
// lifetime asserts if that is the case.
if (ApplicationStatus.isInitialized() && !ApplicationStatus.isEveryActivityDestroyed()) {
return;
}
LifetimeAssert.assertAllInstancesDestroyedForTesting();
Expand Down

0 comments on commit dd3f468

Please sign in to comment.