media/version-compat-tests/previous/client/src/androidTest/java/android/support/mediacompat/client/MediaControllerCompatCallbackTest.java
@Test
    @SmallTest
    public void testSetMetadataWithArtworks() throws Exception {
        // TODO: Add test with a large bitmap.
        // Using large bitmap makes other tests that are executed after this fail.
        final Bitmap bitmapSmall = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);

        synchronized (mWaitLock) {
            mMediaControllerCallback.resetLocked();
            MediaMetadataCompat metadata = new MediaMetadataCompat.Builder()
                    .putString(TEST_KEY, TEST_VALUE)
                    .putBitmap(MediaMetadataCompat.METADATA_KEY_ART, bitmapSmall)
                    .build();

            callMediaSessionMethod(SET_METADATA, metadata, getContext());
            mWaitLock.wait(TIME_OUT_MS);
            assertTrue(mMediaControllerCallback.mOnMetadataChangedCalled);

            MediaMetadataCompat metadataOut = mMediaControllerCallback.mMediaMetadata;
            assertNotNull(metadataOut);
            assertEquals(TEST_VALUE, metadataOut.getString(TEST_KEY));

            Bitmap bitmapSmallOut = metadataOut.getBitmap(MediaMetadataCompat.METADATA_KEY_ART);
            assertNotNull(bitmapSmallOut);
            assertEquals(bitmapSmall.getHeight(), bitmapSmallOut.getHeight());
            assertEquals(bitmapSmall.getWidth(), bitmapSmallOut.getWidth());
            assertEquals(bitmapSmall.getConfig(), bitmapSmallOut.getConfig());

            bitmapSmallOut.recycle();
        }
        bitmapSmall.recycle();
    }
/**
     * Tests {@link MediaSessionCompat#setMetadata} with artwork bitmaps.
     */
Tests  MediaSessionCompat#setMetadata with artwork bitmaps.
Tests MediaSessionCompat#setMetadata with artwork bitmaps .
@Test
    @SmallTest
    public void testSetMetadataWithArtworks() throws Exception {
        final Bitmap bitmapSmall = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
        synchronized (mWaitLock) {
            mMediaControllerCallback.resetLocked();
            MediaMetadataCompat metadata = new MediaMetadataCompat.Builder()
                    .putString(TEST_KEY, TEST_VALUE)
                    .putBitmap(MediaMetadataCompat.METADATA_KEY_ART, bitmapSmall)
                    .build();
            callMediaSessionMethod(SET_METADATA, metadata, getContext());
            mWaitLock.wait(TIME_OUT_MS);
            assertTrue(mMediaControllerCallback.mOnMetadataChangedCalled);
            MediaMetadataCompat metadataOut = mMediaControllerCallback.mMediaMetadata;
            assertNotNull(metadataOut);
            assertEquals(TEST_VALUE, metadataOut.getString(TEST_KEY));
            Bitmap bitmapSmallOut = metadataOut.getBitmap(MediaMetadataCompat.METADATA_KEY_ART);
            assertNotNull(bitmapSmallOut);
            assertEquals(bitmapSmall.getHeight(), bitmapSmallOut.getHeight());
            assertEquals(bitmapSmall.getWidth(), bitmapSmallOut.getWidth());
            assertEquals(bitmapSmall.getConfig(), bitmapSmallOut.getConfig());
            bitmapSmallOut.recycle();
        }
        bitmapSmall.recycle();
    }
@ Test @ SmallTest public void testSetMetadataWithArtworks ( ) throws Exception { final Bitmap bitmapSmall = Bitmap . createBitmap ( 100 , 100 , Bitmap . Config . ARGB_8888 ) ; synchronized ( mWaitLock ) { mMediaControllerCallback . resetLocked ( ) ; MediaMetadataCompat metadata = new MediaMetadataCompat . Builder ( ) . putString ( TEST_KEY , TEST_VALUE ) . putBitmap ( MediaMetadataCompat . METADATA_KEY_ART , bitmapSmall ) . build ( ) ; callMediaSessionMethod ( SET_METADATA , metadata , getContext ( ) ) ; mWaitLock . wait ( TIME_OUT_MS ) ; assertTrue ( mMediaControllerCallback . mOnMetadataChangedCalled ) ; MediaMetadataCompat metadataOut = mMediaControllerCallback . mMediaMetadata ; assertNotNull ( metadataOut ) ; assertEquals ( TEST_VALUE , metadataOut . getString ( TEST_KEY ) ) ; Bitmap bitmapSmallOut = metadataOut . getBitmap ( MediaMetadataCompat . METADATA_KEY_ART ) ; assertNotNull ( bitmapSmallOut ) ; assertEquals ( bitmapSmall . getHeight ( ) , bitmapSmallOut . getHeight ( ) ) ; assertEquals ( bitmapSmall . getWidth ( ) , bitmapSmallOut . getWidth ( ) ) ; assertEquals ( bitmapSmall . getConfig ( ) , bitmapSmallOut . getConfig ( ) ) ; bitmapSmallOut . recycle ( ) ; } bitmapSmall . recycle ( ) ; }
Tests {@link MediaSessionCompat#setMetadata} with artwork bitmaps.
Tests { @link MediaSessionCompat#setMetadata } with artwork bitmaps .
// TODO: Add test with a large bitmap. // Using large bitmap makes other tests that are executed after this fail.