Fix flakiness of testTaskChangeCallBacks
The test verifies that there is no task removed event before the test activity is finished. But the task launched by previous test may be removed when running the current test because the destruction of activity is not done immediately. That causes the assertion of task removed event count to fail. So just only count the event after the current test activity is started to avoid the noise. Bug: 130388819 Test: TaskStackChangedListenerTest#testTaskChangeCallBacks Change-Id: I742cb2f2344a42483af54ecd98fff5a1038900ff
This commit is contained in:
@@ -198,6 +198,10 @@ public class TaskStackChangedListenerTest {
|
||||
|
||||
@Override
|
||||
public void onTaskRemoved(int taskId) throws RemoteException {
|
||||
if (taskCreatedLaunchLatch.getCount() == 1) {
|
||||
// The test activity hasn't started. Ignore the noise from previous test.
|
||||
return;
|
||||
}
|
||||
params[0] = taskId;
|
||||
taskRemovedLatch.countDown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user