Loading android/app/src/com/android/bluetooth/newavrcp/MediaPlayerWrapper.java +1 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ class MediaPlayerWrapper { } List<Metadata> getCurrentQueue() { return Util.toMetadataList(getQueue()); return mCurrentData.queue; } // We don't return the cached info here in order to always provide the freshest data. Loading android/app/tests/unit/src/com/android/bluetooth/newavrcp/MediaPlayerWrapperTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,28 @@ public class MediaPlayerWrapperTest { verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } /* * This test checks to see if the now playing queue data is cached. */ @Test public void testQueueCached() { // Create the wrapper object and register the looper with the timeout handler TestLooperManager looperManager = new TestLooperManager(mThread.getLooper()); MediaPlayerWrapper wrapper = MediaPlayerWrapper.wrap(mMockController, mThread.getLooper()); wrapper.registerCallback(mTestCbs); // Call getCurrentQueue() multiple times. for (int i = 0; i < 3; i++) { Assert.assertEquals(wrapper.getCurrentQueue(), Util.toMetadataList(getQueueFromDescriptions(mTestQueue))); } // Verify that getQueue() was only called twice. Once on creation and once during // registration verify(mMockController, times(2)).getQueue(); } /* * This test sends repeated Playback State updates that only have a short * position update change to see if they get debounced. Loading Loading
android/app/src/com/android/bluetooth/newavrcp/MediaPlayerWrapper.java +1 −1 Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ class MediaPlayerWrapper { } List<Metadata> getCurrentQueue() { return Util.toMetadataList(getQueue()); return mCurrentData.queue; } // We don't return the cached info here in order to always provide the freshest data. Loading
android/app/tests/unit/src/com/android/bluetooth/newavrcp/MediaPlayerWrapperTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,28 @@ public class MediaPlayerWrapperTest { verify(mFailHandler, never()).onTerribleFailure(any(), any(), anyBoolean()); } /* * This test checks to see if the now playing queue data is cached. */ @Test public void testQueueCached() { // Create the wrapper object and register the looper with the timeout handler TestLooperManager looperManager = new TestLooperManager(mThread.getLooper()); MediaPlayerWrapper wrapper = MediaPlayerWrapper.wrap(mMockController, mThread.getLooper()); wrapper.registerCallback(mTestCbs); // Call getCurrentQueue() multiple times. for (int i = 0; i < 3; i++) { Assert.assertEquals(wrapper.getCurrentQueue(), Util.toMetadataList(getQueueFromDescriptions(mTestQueue))); } // Verify that getQueue() was only called twice. Once on creation and once during // registration verify(mMockController, times(2)).getQueue(); } /* * This test sends repeated Playback State updates that only have a short * position update change to see if they get debounced. Loading