mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Fix flakiness of MediaBrowserListenerWithMediaBrowserServiceCompatTest
PiperOrigin-RevId: 688870397 (cherry picked from commit 0038dda3c36568d1f8582db48bd85cd27728f2ff)
This commit is contained in:
parent
70c7ee2e0c
commit
57f0c0d368
@ -698,14 +698,15 @@ public class MediaBrowserListenerWithMediaBrowserServiceCompatTest {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ListenableFuture<LibraryResult<Void>> future =
|
LibraryResult<Void> result =
|
||||||
threadTestRule
|
threadTestRule
|
||||||
.getHandler()
|
.getHandler()
|
||||||
.postAndSync(() -> browser.subscribe("parentId", new LibraryParams.Builder().build()));
|
.postAndSync(() -> browser.subscribe("parentId", new LibraryParams.Builder().build()))
|
||||||
|
.get();
|
||||||
// Trigger calling onLoadChildren that is rejected.
|
// Trigger calling onLoadChildren that is rejected.
|
||||||
remoteService.notifyChildrenChanged("parentId");
|
remoteService.notifyChildrenChanged("parentId");
|
||||||
|
|
||||||
assertThat(future.get().resultCode).isEqualTo(RESULT_SUCCESS);
|
assertThat(result.resultCode).isEqualTo(RESULT_SUCCESS);
|
||||||
assertThat(onChildrenChangedLatch.await(TIMEOUT_MS, MILLISECONDS)).isTrue();
|
assertThat(onChildrenChangedLatch.await(TIMEOUT_MS, MILLISECONDS)).isTrue();
|
||||||
assertThat(changedParentIds).containsExactly("parentId", "parentId");
|
assertThat(changedParentIds).containsExactly("parentId", "parentId");
|
||||||
assertThat(changedItemCounts).containsExactly(2, Integer.MAX_VALUE).inOrder();
|
assertThat(changedItemCounts).containsExactly(2, Integer.MAX_VALUE).inOrder();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user