Loading android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -396,7 +396,7 @@ public class BrowserPlayerWrapperTest { if (item.isFolder) { Folder folder = item.folder; assertThat(folder).isNotNull(); Assert.assertFalse(folder.isPlayable); assertThat(folder.isPlayable).isFalse(); Assert.assertEquals(expected.getDescription().getMediaId(), folder.mediaId); Assert.assertEquals(expected.getDescription().getTitle().toString(), folder.title); } else { Loading android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java +12 −15 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ public class MediaPlayerWrapperTest { // Test isPlaybackStateReady() is false when the playback state is null doReturn(null).when(mMockController).getPlaybackState(); Assert.assertFalse(wrapper.isPlaybackStateReady()); assertThat(wrapper.isPlaybackStateReady()).isFalse(); // Restore the old playback state doReturn(mTestState.build()).when(mMockController).getPlaybackState(); Loading @@ -199,7 +199,7 @@ public class MediaPlayerWrapperTest { // Test isMetadataReady() is false when the metadata is null doReturn(null).when(mMockController).getMetadata(); Assert.assertFalse(wrapper.isMetadataReady()); assertThat(wrapper.isMetadataReady()).isFalse(); // Restore the old metadata doReturn(mTestMetadata.build()).when(mMockController).getMetadata(); Loading Loading @@ -294,7 +294,7 @@ public class MediaPlayerWrapperTest { Assert.assertEquals("Returned Queue isn't empty", data.queue.size(), 0); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -343,7 +343,7 @@ public class MediaPlayerWrapperTest { Assert.assertEquals("Returned Queue isn't empty", data.queue.size(), 0); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -468,19 +468,16 @@ public class MediaPlayerWrapperTest { MediaPlayerWrapperFactory.wrap(mMockContext, mMockController, mThread.getLooper()); doReturn(null).when(mMockController).getMetadata(); Assert.assertFalse( Util.toMetadata(mMockContext, mTestMetadata.build()) .duration .equals(wrapper.getCurrentQueue().get(0).duration)); assertThat(Util.toMetadata(mMockContext, mTestMetadata.build()).duration) .isNotEqualTo(wrapper.getCurrentQueue().get(0).duration); doReturn(mTestMetadata.build()).when(mMockController).getMetadata(); Assert.assertEquals( Util.toMetadata(mMockContext, mTestMetadata.build()).duration, wrapper.getCurrentQueue().get(0).duration); // The MediaController Metadata should still not be equal to the queue // as the track count is different and should not be overridden. Assert.assertFalse( Util.toMetadata(mMockContext, mTestMetadata.build()) .equals(wrapper.getCurrentQueue().get(0))); assertThat(Util.toMetadata(mMockContext, mTestMetadata.build())) .isNotEqualTo(wrapper.getCurrentQueue().get(0)); } /* Loading Loading @@ -535,7 +532,7 @@ public class MediaPlayerWrapperTest { controllerCallbacks.onPlaybackStateChanged(mTestState.build()); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -581,7 +578,7 @@ public class MediaPlayerWrapperTest { verify(mTestCbs, never()).mediaUpdatedCallback(any()); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -640,7 +637,7 @@ public class MediaPlayerWrapperTest { Util.toMetadataList(mMockContext, getQueueFromDescriptions(mTestQueue))); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -769,7 +766,7 @@ public class MediaPlayerWrapperTest { } // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +11 −11 Original line number Diff line number Diff line Loading @@ -755,7 +755,7 @@ public class AvrcpControllerStateMachineTest { AvrcpControllerStateMachine.MESSAGE_PROCESS_AVAILABLE_PLAYER_CHANGED); // Verify we've uncached our browse root and made the call to fetch new players Assert.assertFalse(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()); assertThat(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()).isFalse(); verify(mNativeInterface, timeout(ASYNC_CALL_TIMEOUT_MILLIS).times(1)) .getPlayerList(eq(mTestAddress), eq(0), eq(19)); } Loading Loading @@ -784,7 +784,7 @@ public class AvrcpControllerStateMachineTest { AvrcpControllerStateMachine.MESSAGE_PROCESS_AVAILABLE_PLAYER_CHANGED); // Verify we've uncached our browse root and made the call to fetch new players Assert.assertFalse(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()); assertThat(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()).isFalse(); verify(mNativeInterface, timeout(ASYNC_CALL_TIMEOUT_MILLIS).times(1)) .getPlayerList(eq(mTestAddress), eq(0), eq(19)); Loading Loading @@ -835,7 +835,7 @@ public class AvrcpControllerStateMachineTest { AvrcpControllerStateMachine.MESSAGE_PROCESS_AVAILABLE_PLAYER_CHANGED); // Verify we've uncached our browse root and made the call to fetch new players Assert.assertFalse(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()); assertThat(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()).isFalse(); verify(mNativeInterface, timeout(ASYNC_CALL_TIMEOUT_MILLIS).times(1)) .getPlayerList(eq(mTestAddress), eq(0), eq(19)); Loading Loading @@ -1217,7 +1217,7 @@ public class AvrcpControllerStateMachineTest { @Test public void testIsActive_deviceInactive() { setActiveDevice(null); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); } /** Test becoming active from the inactive state */ Loading @@ -1230,7 +1230,7 @@ public class AvrcpControllerStateMachineTest { // Make the device inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); // Change device state while inactive AvrcpItem track = makeTrack("title", "artist", "album", 1, 10, "none", 10, null); Loading Loading @@ -1293,7 +1293,7 @@ public class AvrcpControllerStateMachineTest { eq(mTestAddress), eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_DOWN)); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); } @Test Loading Loading @@ -1368,7 +1368,7 @@ public class AvrcpControllerStateMachineTest { // becoming inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); // Change track while inactive AvrcpItem track = makeTrack("title", "artist", "album", 1, 10, "none", 10, null); Loading @@ -1391,7 +1391,7 @@ public class AvrcpControllerStateMachineTest { // Set the active device to something else, verify we're inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); clearInvocations(mAvrcpControllerService); clearInvocations(mNativeInterface); Loading Loading @@ -1419,7 +1419,7 @@ public class AvrcpControllerStateMachineTest { // Set the active device to something else, verify we're inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); clearInvocations(mAvrcpControllerService); clearInvocations(mNativeInterface); Loading @@ -1446,7 +1446,7 @@ public class AvrcpControllerStateMachineTest { // becoming inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); // Change queue while inactive List<AvrcpItem> nowPlayingList = new ArrayList<AvrcpItem>(); Loading Loading @@ -1991,7 +1991,7 @@ public class AvrcpControllerStateMachineTest { // Request for new contents should be sent verify(mNativeInterface).getNowPlayingList(eq(mTestAddress), eq(0), eq(19)); Assert.assertFalse(nowPlaying.isCached()); assertThat(nowPlaying.isCached()).isFalse(); // Send timeout on our own instead of waiting 10 seconds mAvrcpStateMachine.sendMessage(AvrcpControllerStateMachine.MESSAGE_INTERNAL_CMD_TIMEOUT); Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorageTest.java +23 −23 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ public final class AvrcpCoverArtStorageTest { @Test public void addNewImage_imageExists() { Uri expectedUri = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, mImage1); Loading @@ -102,7 +102,7 @@ public final class AvrcpCoverArtStorageTest { @Test public void addExistingImage_imageUpdated() { Uri expectedUri = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, mImage1); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isTrue(); Loading @@ -119,8 +119,8 @@ public final class AvrcpCoverArtStorageTest { public void addTwoImageSameDevice_bothExist() { Uri expectedUri1 = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle1); Uri expectedUri2 = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle2); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isFalse(); Uri uri1 = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, mImage1); Uri uri2 = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle2, mImage2); Loading @@ -136,8 +136,8 @@ public final class AvrcpCoverArtStorageTest { public void addTwoImageDifferentDevices_bothExist() { Uri expectedUri1 = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle1); Uri expectedUri2 = AvrcpCoverArtProvider.getImageUri(mDevice2, mHandle1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)).isFalse(); Uri uri1 = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, mImage1); Uri uri2 = mAvrcpCoverArtStorage.addImage(mDevice2, mHandle1, mImage1); Loading @@ -152,28 +152,28 @@ public final class AvrcpCoverArtStorageTest { @Test public void addNullImage_imageNotAdded() { Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, null); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Assert.assertEquals(null, uri); } @Test public void addImageNullDevice_imageNotAdded() { Uri uri = mAvrcpCoverArtStorage.addImage(null, mHandle1, mImage1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Assert.assertEquals(null, uri); } @Test public void addImageNullHandle_imageNotAdded() { Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, null, mImage1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Assert.assertEquals(null, uri); } @Test public void addImageEmptyHandle_imageNotAdded() { Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, "", mImage1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Assert.assertEquals(null, uri); } Loading @@ -196,28 +196,28 @@ public final class AvrcpCoverArtStorageTest { @Test public void getImageThatDoesntExist_returnsNull() { Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Bitmap image = mAvrcpCoverArtStorage.getImage(mDevice1, mHandle1); Assert.assertEquals(null, image); } @Test public void getImageNullDevice_returnsNull() { Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Bitmap image = mAvrcpCoverArtStorage.getImage(null, mHandle1); Assert.assertEquals(null, image); } @Test public void getImageNullHandle_returnsNull() { Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Bitmap image = mAvrcpCoverArtStorage.getImage(mDevice1, null); Assert.assertEquals(null, image); } @Test public void getImageEmptyHandle_returnsNull() { Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Bitmap image = mAvrcpCoverArtStorage.getImage(mDevice1, ""); Assert.assertEquals(null, image); } Loading @@ -228,7 +228,7 @@ public final class AvrcpCoverArtStorageTest { mAvrcpCoverArtStorage.addImage(mDevice1, mHandle2, mImage1); mAvrcpCoverArtStorage.addImage(mDevice2, mHandle1, mImage1); mAvrcpCoverArtStorage.removeImage(mDevice1, mHandle1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isTrue(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)).isTrue(); } Loading Loading @@ -276,8 +276,8 @@ public final class AvrcpCoverArtStorageTest { mAvrcpCoverArtStorage.removeImagesForDevice(mDevice1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)).isTrue(); } Loading Loading @@ -310,8 +310,8 @@ public final class AvrcpCoverArtStorageTest { mAvrcpCoverArtStorage.clear(); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isFalse(); } @Test Loading @@ -323,10 +323,10 @@ public final class AvrcpCoverArtStorageTest { mAvrcpCoverArtStorage.clear(); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle2)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle2)).isFalse(); } @Test Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpItemTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.bluetooth.avrcpcontroller; import static com.google.common.truth.Truth.assertThat; import android.annotation.SuppressLint; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.net.Uri; Loading Loading @@ -475,7 +476,7 @@ public final class AvrcpItemTest { null, metadata.getBitmap(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON)); Assert.assertEquals(null, metadata.getBitmap(MediaMetadataCompat.METADATA_KEY_ART)); Assert.assertEquals(null, metadata.getBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART)); Assert.assertFalse(metadata.containsKey(MediaMetadataCompat.METADATA_KEY_BT_FOLDER_TYPE)); assertThat(metadata.containsKey(MediaMetadataCompat.METADATA_KEY_BT_FOLDER_TYPE)).isFalse(); } @Test Loading Loading @@ -548,7 +549,7 @@ public final class AvrcpItemTest { MediaDescriptionCompat desc = mediaItem.getDescription(); assertThat(mediaItem.isPlayable()).isTrue(); Assert.assertFalse(mediaItem.isBrowsable()); assertThat(mediaItem.isBrowsable()).isFalse(); Assert.assertEquals(UUID, mediaItem.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Loading Loading @@ -577,7 +578,7 @@ public final class AvrcpItemTest { MediaDescriptionCompat desc = mediaItem.getDescription(); assertThat(mediaItem.isPlayable()).isTrue(); Assert.assertFalse(mediaItem.isBrowsable()); assertThat(mediaItem.isBrowsable()).isFalse(); Assert.assertEquals(UUID, mediaItem.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Loading @@ -603,7 +604,7 @@ public final class AvrcpItemTest { MediaItem mediaItem = item.toMediaItem(); MediaDescriptionCompat desc = mediaItem.getDescription(); Assert.assertFalse(mediaItem.isPlayable()); assertThat(mediaItem.isPlayable()).isFalse(); assertThat(mediaItem.isBrowsable()).isTrue(); Assert.assertEquals(UUID, mediaItem.getMediaId()); Loading @@ -625,13 +626,14 @@ public final class AvrcpItemTest { } @Test @SuppressLint("TruthIncompatibleType") // That the point of this test public void equals_withDifferentInstance() { AvrcpItem.Builder builder = new AvrcpItem.Builder(); String notAvrcpItem = "notAvrcpItem"; AvrcpItem item = builder.build(); Assert.assertFalse(item.equals(notAvrcpItem)); assertThat(item).isNotEqualTo(notAvrcpItem); } @Test Loading Loading
android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -396,7 +396,7 @@ public class BrowserPlayerWrapperTest { if (item.isFolder) { Folder folder = item.folder; assertThat(folder).isNotNull(); Assert.assertFalse(folder.isPlayable); assertThat(folder.isPlayable).isFalse(); Assert.assertEquals(expected.getDescription().getMediaId(), folder.mediaId); Assert.assertEquals(expected.getDescription().getTitle().toString(), folder.title); } else { Loading
android/app/tests/unit/src/com/android/bluetooth/audio_util/MediaPlayerWrapperTest.java +12 −15 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ public class MediaPlayerWrapperTest { // Test isPlaybackStateReady() is false when the playback state is null doReturn(null).when(mMockController).getPlaybackState(); Assert.assertFalse(wrapper.isPlaybackStateReady()); assertThat(wrapper.isPlaybackStateReady()).isFalse(); // Restore the old playback state doReturn(mTestState.build()).when(mMockController).getPlaybackState(); Loading @@ -199,7 +199,7 @@ public class MediaPlayerWrapperTest { // Test isMetadataReady() is false when the metadata is null doReturn(null).when(mMockController).getMetadata(); Assert.assertFalse(wrapper.isMetadataReady()); assertThat(wrapper.isMetadataReady()).isFalse(); // Restore the old metadata doReturn(mTestMetadata.build()).when(mMockController).getMetadata(); Loading Loading @@ -294,7 +294,7 @@ public class MediaPlayerWrapperTest { Assert.assertEquals("Returned Queue isn't empty", data.queue.size(), 0); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -343,7 +343,7 @@ public class MediaPlayerWrapperTest { Assert.assertEquals("Returned Queue isn't empty", data.queue.size(), 0); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -468,19 +468,16 @@ public class MediaPlayerWrapperTest { MediaPlayerWrapperFactory.wrap(mMockContext, mMockController, mThread.getLooper()); doReturn(null).when(mMockController).getMetadata(); Assert.assertFalse( Util.toMetadata(mMockContext, mTestMetadata.build()) .duration .equals(wrapper.getCurrentQueue().get(0).duration)); assertThat(Util.toMetadata(mMockContext, mTestMetadata.build()).duration) .isNotEqualTo(wrapper.getCurrentQueue().get(0).duration); doReturn(mTestMetadata.build()).when(mMockController).getMetadata(); Assert.assertEquals( Util.toMetadata(mMockContext, mTestMetadata.build()).duration, wrapper.getCurrentQueue().get(0).duration); // The MediaController Metadata should still not be equal to the queue // as the track count is different and should not be overridden. Assert.assertFalse( Util.toMetadata(mMockContext, mTestMetadata.build()) .equals(wrapper.getCurrentQueue().get(0))); assertThat(Util.toMetadata(mMockContext, mTestMetadata.build())) .isNotEqualTo(wrapper.getCurrentQueue().get(0)); } /* Loading Loading @@ -535,7 +532,7 @@ public class MediaPlayerWrapperTest { controllerCallbacks.onPlaybackStateChanged(mTestState.build()); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -581,7 +578,7 @@ public class MediaPlayerWrapperTest { verify(mTestCbs, never()).mediaUpdatedCallback(any()); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -640,7 +637,7 @@ public class MediaPlayerWrapperTest { Util.toMetadataList(mMockContext, getQueueFromDescriptions(mTestQueue))); // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading Loading @@ -769,7 +766,7 @@ public class MediaPlayerWrapperTest { } // Verify that there are no timeout messages pending and there were no timeouts Assert.assertFalse(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)); assertThat(wrapper.getTimeoutHandler().hasMessages(MSG_TIMEOUT)).isFalse(); verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +11 −11 Original line number Diff line number Diff line Loading @@ -755,7 +755,7 @@ public class AvrcpControllerStateMachineTest { AvrcpControllerStateMachine.MESSAGE_PROCESS_AVAILABLE_PLAYER_CHANGED); // Verify we've uncached our browse root and made the call to fetch new players Assert.assertFalse(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()); assertThat(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()).isFalse(); verify(mNativeInterface, timeout(ASYNC_CALL_TIMEOUT_MILLIS).times(1)) .getPlayerList(eq(mTestAddress), eq(0), eq(19)); } Loading Loading @@ -784,7 +784,7 @@ public class AvrcpControllerStateMachineTest { AvrcpControllerStateMachine.MESSAGE_PROCESS_AVAILABLE_PLAYER_CHANGED); // Verify we've uncached our browse root and made the call to fetch new players Assert.assertFalse(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()); assertThat(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()).isFalse(); verify(mNativeInterface, timeout(ASYNC_CALL_TIMEOUT_MILLIS).times(1)) .getPlayerList(eq(mTestAddress), eq(0), eq(19)); Loading Loading @@ -835,7 +835,7 @@ public class AvrcpControllerStateMachineTest { AvrcpControllerStateMachine.MESSAGE_PROCESS_AVAILABLE_PLAYER_CHANGED); // Verify we've uncached our browse root and made the call to fetch new players Assert.assertFalse(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()); assertThat(mAvrcpStateMachine.mBrowseTree.mRootNode.isCached()).isFalse(); verify(mNativeInterface, timeout(ASYNC_CALL_TIMEOUT_MILLIS).times(1)) .getPlayerList(eq(mTestAddress), eq(0), eq(19)); Loading Loading @@ -1217,7 +1217,7 @@ public class AvrcpControllerStateMachineTest { @Test public void testIsActive_deviceInactive() { setActiveDevice(null); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); } /** Test becoming active from the inactive state */ Loading @@ -1230,7 +1230,7 @@ public class AvrcpControllerStateMachineTest { // Make the device inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); // Change device state while inactive AvrcpItem track = makeTrack("title", "artist", "album", 1, 10, "none", 10, null); Loading Loading @@ -1293,7 +1293,7 @@ public class AvrcpControllerStateMachineTest { eq(mTestAddress), eq(AvrcpControllerService.PASS_THRU_CMD_ID_PAUSE), eq(KEY_DOWN)); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); } @Test Loading Loading @@ -1368,7 +1368,7 @@ public class AvrcpControllerStateMachineTest { // becoming inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); // Change track while inactive AvrcpItem track = makeTrack("title", "artist", "album", 1, 10, "none", 10, null); Loading @@ -1391,7 +1391,7 @@ public class AvrcpControllerStateMachineTest { // Set the active device to something else, verify we're inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); clearInvocations(mAvrcpControllerService); clearInvocations(mNativeInterface); Loading Loading @@ -1419,7 +1419,7 @@ public class AvrcpControllerStateMachineTest { // Set the active device to something else, verify we're inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); clearInvocations(mAvrcpControllerService); clearInvocations(mNativeInterface); Loading @@ -1446,7 +1446,7 @@ public class AvrcpControllerStateMachineTest { // becoming inactive setActiveDevice(null); TestUtils.waitForLooperToFinishScheduledTask(mAvrcpStateMachine.getHandler().getLooper()); Assert.assertFalse(mAvrcpStateMachine.isActive()); assertThat(mAvrcpStateMachine.isActive()).isFalse(); // Change queue while inactive List<AvrcpItem> nowPlayingList = new ArrayList<AvrcpItem>(); Loading Loading @@ -1991,7 +1991,7 @@ public class AvrcpControllerStateMachineTest { // Request for new contents should be sent verify(mNativeInterface).getNowPlayingList(eq(mTestAddress), eq(0), eq(19)); Assert.assertFalse(nowPlaying.isCached()); assertThat(nowPlaying.isCached()).isFalse(); // Send timeout on our own instead of waiting 10 seconds mAvrcpStateMachine.sendMessage(AvrcpControllerStateMachine.MESSAGE_INTERNAL_CMD_TIMEOUT); Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpCoverArtStorageTest.java +23 −23 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ public final class AvrcpCoverArtStorageTest { @Test public void addNewImage_imageExists() { Uri expectedUri = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, mImage1); Loading @@ -102,7 +102,7 @@ public final class AvrcpCoverArtStorageTest { @Test public void addExistingImage_imageUpdated() { Uri expectedUri = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, mImage1); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isTrue(); Loading @@ -119,8 +119,8 @@ public final class AvrcpCoverArtStorageTest { public void addTwoImageSameDevice_bothExist() { Uri expectedUri1 = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle1); Uri expectedUri2 = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle2); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isFalse(); Uri uri1 = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, mImage1); Uri uri2 = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle2, mImage2); Loading @@ -136,8 +136,8 @@ public final class AvrcpCoverArtStorageTest { public void addTwoImageDifferentDevices_bothExist() { Uri expectedUri1 = AvrcpCoverArtProvider.getImageUri(mDevice1, mHandle1); Uri expectedUri2 = AvrcpCoverArtProvider.getImageUri(mDevice2, mHandle1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)).isFalse(); Uri uri1 = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, mImage1); Uri uri2 = mAvrcpCoverArtStorage.addImage(mDevice2, mHandle1, mImage1); Loading @@ -152,28 +152,28 @@ public final class AvrcpCoverArtStorageTest { @Test public void addNullImage_imageNotAdded() { Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, mHandle1, null); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Assert.assertEquals(null, uri); } @Test public void addImageNullDevice_imageNotAdded() { Uri uri = mAvrcpCoverArtStorage.addImage(null, mHandle1, mImage1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Assert.assertEquals(null, uri); } @Test public void addImageNullHandle_imageNotAdded() { Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, null, mImage1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Assert.assertEquals(null, uri); } @Test public void addImageEmptyHandle_imageNotAdded() { Uri uri = mAvrcpCoverArtStorage.addImage(mDevice1, "", mImage1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Assert.assertEquals(null, uri); } Loading @@ -196,28 +196,28 @@ public final class AvrcpCoverArtStorageTest { @Test public void getImageThatDoesntExist_returnsNull() { Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Bitmap image = mAvrcpCoverArtStorage.getImage(mDevice1, mHandle1); Assert.assertEquals(null, image); } @Test public void getImageNullDevice_returnsNull() { Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Bitmap image = mAvrcpCoverArtStorage.getImage(null, mHandle1); Assert.assertEquals(null, image); } @Test public void getImageNullHandle_returnsNull() { Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Bitmap image = mAvrcpCoverArtStorage.getImage(mDevice1, null); Assert.assertEquals(null, image); } @Test public void getImageEmptyHandle_returnsNull() { Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); Bitmap image = mAvrcpCoverArtStorage.getImage(mDevice1, ""); Assert.assertEquals(null, image); } Loading @@ -228,7 +228,7 @@ public final class AvrcpCoverArtStorageTest { mAvrcpCoverArtStorage.addImage(mDevice1, mHandle2, mImage1); mAvrcpCoverArtStorage.addImage(mDevice2, mHandle1, mImage1); mAvrcpCoverArtStorage.removeImage(mDevice1, mHandle1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isTrue(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)).isTrue(); } Loading Loading @@ -276,8 +276,8 @@ public final class AvrcpCoverArtStorageTest { mAvrcpCoverArtStorage.removeImagesForDevice(mDevice1); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)).isTrue(); } Loading Loading @@ -310,8 +310,8 @@ public final class AvrcpCoverArtStorageTest { mAvrcpCoverArtStorage.clear(); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isFalse(); } @Test Loading @@ -323,10 +323,10 @@ public final class AvrcpCoverArtStorageTest { mAvrcpCoverArtStorage.clear(); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)); Assert.assertFalse(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle2)); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice1, mHandle2)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle1)).isFalse(); assertThat(mAvrcpCoverArtStorage.doesImageExist(mDevice2, mHandle2)).isFalse(); } @Test Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpItemTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.bluetooth.avrcpcontroller; import static com.google.common.truth.Truth.assertThat; import android.annotation.SuppressLint; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.net.Uri; Loading Loading @@ -475,7 +476,7 @@ public final class AvrcpItemTest { null, metadata.getBitmap(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON)); Assert.assertEquals(null, metadata.getBitmap(MediaMetadataCompat.METADATA_KEY_ART)); Assert.assertEquals(null, metadata.getBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART)); Assert.assertFalse(metadata.containsKey(MediaMetadataCompat.METADATA_KEY_BT_FOLDER_TYPE)); assertThat(metadata.containsKey(MediaMetadataCompat.METADATA_KEY_BT_FOLDER_TYPE)).isFalse(); } @Test Loading Loading @@ -548,7 +549,7 @@ public final class AvrcpItemTest { MediaDescriptionCompat desc = mediaItem.getDescription(); assertThat(mediaItem.isPlayable()).isTrue(); Assert.assertFalse(mediaItem.isBrowsable()); assertThat(mediaItem.isBrowsable()).isFalse(); Assert.assertEquals(UUID, mediaItem.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Loading Loading @@ -577,7 +578,7 @@ public final class AvrcpItemTest { MediaDescriptionCompat desc = mediaItem.getDescription(); assertThat(mediaItem.isPlayable()).isTrue(); Assert.assertFalse(mediaItem.isBrowsable()); assertThat(mediaItem.isBrowsable()).isFalse(); Assert.assertEquals(UUID, mediaItem.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Loading @@ -603,7 +604,7 @@ public final class AvrcpItemTest { MediaItem mediaItem = item.toMediaItem(); MediaDescriptionCompat desc = mediaItem.getDescription(); Assert.assertFalse(mediaItem.isPlayable()); assertThat(mediaItem.isPlayable()).isFalse(); assertThat(mediaItem.isBrowsable()).isTrue(); Assert.assertEquals(UUID, mediaItem.getMediaId()); Loading @@ -625,13 +626,14 @@ public final class AvrcpItemTest { } @Test @SuppressLint("TruthIncompatibleType") // That the point of this test public void equals_withDifferentInstance() { AvrcpItem.Builder builder = new AvrcpItem.Builder(); String notAvrcpItem = "notAvrcpItem"; AvrcpItem item = builder.build(); Assert.assertFalse(item.equals(notAvrcpItem)); assertThat(item).isNotEqualTo(notAvrcpItem); } @Test Loading