TweetMediaUtils { static boolean isVariantSupported(VideoInfo.Variant variant) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && CONTENT_TYPE_HLS.equals(variant.contentType)) { return true; } else if (CONTENT_TYPE_MP4.equals(variant.contentType)) { return true; } return false; } private  TweetMediaUtils(); static MediaEntity getPhotoEntity(Tweet tweet); static List<MediaEntity> getPhotoEntities(Tweet tweet); static boolean hasPhoto(Tweet tweet); static MediaEntity getVideoEntity(Tweet tweet); static boolean hasSupportedVideo(Tweet tweet); static VideoInfo.Variant getSupportedVariant(MediaEntity mediaEntity); static boolean isLooping(MediaEntity mediaEntity); static boolean showVideoControls(MediaEntity mediaEntity); static final String PHOTO_TYPE; static final String VIDEO_TYPE; static final String GIF_TYPE; }
@Test public void testIsVariantSupported_withMP4() { final VideoInfo.Variant variant = new VideoInfo.Variant(0, TEST_CONTENT_TYPE_MP4, null); assertTrue(TweetMediaUtils.isVariantSupported(variant)); }
@Test public void testIsVariantSupported_withHLS() { final VideoInfo.Variant variant = new VideoInfo.Variant(0, TEST_CONTENT_TYPE_HLS, null); assertTrue(TweetMediaUtils.isVariantSupported(variant)); }
@Test public void testIsVariantSupported_withNullContentType() { final VideoInfo.Variant variant = new VideoInfo.Variant(0, null, null); assertFalse(TweetMediaUtils.isVariantSupported(variant)); }
@Test public void testIsVariantSupported_withUnsupportedContentType() { final VideoInfo.Variant variant = new VideoInfo.Variant(0, TEST_CONTENT_TYPE_DASH, null); assertFalse(TweetMediaUtils.isVariantSupported(variant)); }