FileDocCategorySizeDatePackage
MediaMimeTest.javaAPI DocAndroid 5.1 API5167Thu Mar 12 22:22:30 GMT 2015com.android.mediaframeworktest.functional

MediaMimeTest

public class MediaMimeTest extends android.test.ActivityInstrumentationTestCase2

Fields Summary
private final String
TAG
private android.content.Context
mContext
private final String
MP3_FILE
Constructors Summary
public MediaMimeTest()


      
        super("com.android.mediaframeworktest", MediaFrameworkTest.class);
    
Methods Summary
private voidassertMediaPlaybackActivityHandles(java.lang.String mime)

        ResolveInfo ri = resolveMime(mime);

        assertNotNull(ri);
    
private voidassertNoActivityHandles(java.lang.String mime)

        assertNull(resolveMime(mime));
    
private android.content.pm.ResolveInforesolveMime(java.lang.String mime)

        Intent viewIntent = new Intent(Intent.ACTION_VIEW);
        Uri uri = Uri.fromParts("file", MP3_FILE, null);

        viewIntent.setDataAndType(uri, mime);
        return mContext.getPackageManager().resolveActivity(
                viewIntent, PackageManager.MATCH_DEFAULT_ONLY);
    
protected voidsetUp()

      super.setUp();
      mContext = getActivity();
      // Checks you have all the test files on your SDCARD.
      assertTrue(new File(MP3_FILE).exists());
    
protected voidtearDown()

     
        super.tearDown();              
    
public voidtestCheckActivityResolverMimeHandlingIsCaseSensitive()

        assertNoActivityHandles("AUDIO/MP3");   // <--- look uppercase
    
public voidtestCheckMediaPlaybackHandlesApplicationItunes()

        assertMediaPlaybackActivityHandles("application/itunes");
    
public voidtestCheckMediaPlaybackHandlesAudio()

        assertMediaPlaybackActivityHandles("audio/*");
    
public voidtestCheckMediaPlaybackHandlesAudioMp3()

        assertMediaPlaybackActivityHandles("audio/mp3");
    
public voidtestCheckWhiteSpacesInMimeTypeHandling()

        assertNoActivityHandles(" audio/mp3");
        assertNoActivityHandles(" audio/mp3 ");
        assertMediaPlaybackActivityHandles("audio/mp3 ");