Fix flakiness of MediaBrowserListenerWithMediaBrowserServiceCompatTest

PiperOrigin-RevId: 688870397
(cherry picked from commit 0038dda3c36568d1f8582db48bd85cd27728f2ff)
This commit is contained in:
bachinger 2024-10-23 01:51:57 -07:00 committed by Iván Budnik
parent 70c7ee2e0c
commit 57f0c0d368

View File

@ -698,14 +698,15 @@ public class MediaBrowserListenerWithMediaBrowserServiceCompatTest {
}
});
ListenableFuture<LibraryResult<Void>> future =
LibraryResult<Void> result =
threadTestRule
.getHandler()
.postAndSync(() -> browser.subscribe("parentId", new LibraryParams.Builder().build()));
.postAndSync(() -> browser.subscribe("parentId", new LibraryParams.Builder().build()))
.get();
// Trigger calling onLoadChildren that is rejected.
remoteService.notifyChildrenChanged("parentId");
assertThat(future.get().resultCode).isEqualTo(RESULT_SUCCESS);
assertThat(result.resultCode).isEqualTo(RESULT_SUCCESS);
assertThat(onChildrenChangedLatch.await(TIMEOUT_MS, MILLISECONDS)).isTrue();
assertThat(changedParentIds).containsExactly("parentId", "parentId");
assertThat(changedItemCounts).containsExactly(2, Integer.MAX_VALUE).inOrder();