Minor naming cleanup in MediaControllerListenerTest

PiperOrigin-RevId: 480041937
This commit is contained in:
christosts 2022-10-10 10:42:01 +00:00 committed by Marc Baechinger
parent 266de1b21b
commit 6f8863fc11

View File

@ -258,7 +258,7 @@ public class MediaControllerListenerTest {
threadTestRule.getHandler().postAndSync(controller::release); threadTestRule.getHandler().postAndSync(controller::release);
// release is done immediately for session. // release is done immediately for session.
testNoInteraction(controller); assertNoInteraction(controller);
// Test whether the controller is notified about later release of the session or // Test whether the controller is notified about later release of the session or
// re-creation. // re-creation.
@ -2603,31 +2603,28 @@ public class MediaControllerListenerTest {
// This causes the session service to die. // This causes the session service to die.
remoteSession.release(); remoteSession.release();
// controllerTestRule.waitForDisconnect(controller, true); // controllerTestRule.waitForDisconnect(controller, true);
testNoInteraction(controller); assertNoInteraction(controller);
// Ensure that the controller cannot use newly create session with the same ID. // Ensure that the controller cannot use newly create session with the same ID.
// Recreated session has different session stub, so previously created controller // Recreated session has different session stub, so previously created controller
// shouldn't be available. // shouldn't be available.
remoteSession = createRemoteMediaSession(id); remoteSession = createRemoteMediaSession(id);
testNoInteraction(controller); assertNoInteraction(controller);
} }
// Test that session and controller doesn't interact. /**
// Note that this method can be called after the session is died, so session may not have * Asserts that {@link #remoteSession} and {@code controller} don't interact.
// valid player. *
private void testNoInteraction(MediaController controller) throws Exception { * <p>Note that this method can be called after the session is died, so {@link #remoteSession} may
* not have valid player.
*/
private void assertNoInteraction(MediaController controller) throws Exception {
// TODO: check that calls from the controller to session shouldn't be delivered. // TODO: check that calls from the controller to session shouldn't be delivered.
// Calls from the session to controller shouldn't be delivered. // Calls from the session to controller shouldn't be delivered.
CountDownLatch latch = new CountDownLatch(1); CountDownLatch latch = new CountDownLatch(1);
controllerTestRule.setRunnableForOnCustomCommand( controllerTestRule.setRunnableForOnCustomCommand(
controller, controller, /* runnable= */ () -> latch.countDown());
new Runnable() {
@Override
public void run() {
latch.countDown();
}
});
SessionCommand customCommand = SessionCommand customCommand =
new SessionCommand("testNoInteraction", /* extras= */ Bundle.EMPTY); new SessionCommand("testNoInteraction", /* extras= */ Bundle.EMPTY);