summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2024-11-12 14:33:32 +0800
committer Riddle Hsu <riddlehsu@google.com> 2024-11-12 14:33:32 +0800
commit5addb3b37ed1a9714a1bd135394dcf36c2188d9d (patch)
tree32671222f74ef8104c08f7b63ee0beaa4694f780
parent247a20f2ee52efce4e260ae7f2bd105458857b74 (diff)
Clarify unit test testOnStartingWindowDrawn
It becomes flaky with unknown reason. Make some conditions more explicit to clarify. Fix: 378177797 Flag: EXEMPT unit test Test: ActivityRecordTests#testOnStartingWindowDrawn Change-Id: I9aedeb442e7de473fb8f10b44452f98c37f2f1f8
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
index c3466b9cee18..fee646d9cb9c 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java
@@ -3139,11 +3139,13 @@ public class ActivityRecordTests extends WindowTestsBase {
@Test
public void testOnStartingWindowDrawn() {
+ // Skip unnecessary resume top.
+ mSupervisor.beginDeferResume();
final ActivityRecord activity = new ActivityBuilder(mAtm).setCreateTask(true).build();
// The task-has-been-visible should not affect the decision of making transition ready.
activity.getTask().setHasBeenVisible(true);
activity.detachFromProcess();
- activity.mStartingData = mock(StartingData.class);
+ activity.mStartingData = new SplashScreenStartingData(mWm, 0, 0);
registerTestTransitionPlayer();
final Transition transition = activity.mTransitionController.requestTransitionIfNeeded(
WindowManager.TRANSIT_OPEN, 0 /* flags */, null /* trigger */, mDisplayContent);
@@ -3151,7 +3153,11 @@ public class ActivityRecordTests extends WindowTestsBase {
assertTrue(activity.mStartingData.mIsDisplayed);
// The transition can be ready by the starting window of a visible-requested activity
// without a running process.
- assertTrue(transition.allReady());
+ if (!transition.allReady()) {
+ // Print unsatisfied conditions.
+ transition.onReadyTimeout();
+ Assert.fail(transition + " must be ready by onStartingWindowDrawn");
+ }
// If other event makes the transition unready, the reentrant of onStartingWindowDrawn
// should not replace the readiness again.