mirror of
https://github.com/androidx/media.git
synced 2025-05-06 23:20:42 +08:00
Fix tests
This commit is contained in:
parent
bcc4f797b2
commit
1475f78dc6
File diff suppressed because it is too large
Load Diff
@ -24,6 +24,7 @@ import static com.google.android.exoplayer2.util.Util.parseXsDuration;
|
||||
import static com.google.android.exoplayer2.util.Util.unescapeFileName;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.net.Uri;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||
@ -115,13 +116,39 @@ public class UtilTest {
|
||||
assertThat(Util.inferContentType("http://a.b/c.ism/Manifest")).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType("http://a.b/c.isml/manifest")).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType("http://a.b/c.isml/manifest(filter=x)")).isEqualTo(C.TYPE_SS);
|
||||
assertThat(Util.inferContentType("http://a.b/c.isml/manifest_hd")).isEqualTo(C.TYPE_SS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void inferContentType_handlesOtherIsmUris() {
|
||||
assertThat(Util.inferContentType("http://a.b/c.ism/video.mp4")).isEqualTo(C.TYPE_OTHER);
|
||||
assertThat(Util.inferContentType("http://a.b/c.ism/prefix-manifest")).isEqualTo(C.TYPE_OTHER);
|
||||
assertThat(Util.inferContentType("http://a.b/c.ism/manifest-suffix")).isEqualTo(C.TYPE_OTHER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fixSmoothStreamingIsmManifestUri_addsManifestSuffix() {
|
||||
assertThat(Util.fixSmoothStreamingIsmManifestUri(Uri.parse("http://a.b/c.ism")))
|
||||
.isEqualTo(Uri.parse("http://a.b/c.ism/Manifest"));
|
||||
assertThat(Util.fixSmoothStreamingIsmManifestUri(Uri.parse("http://a.b/c.isml")))
|
||||
.isEqualTo(Uri.parse("http://a.b/c.isml/Manifest"));
|
||||
|
||||
assertThat(Util.fixSmoothStreamingIsmManifestUri(Uri.parse("http://a.b/c.ism/")))
|
||||
.isEqualTo(Uri.parse("http://a.b/c.ism/Manifest"));
|
||||
assertThat(Util.fixSmoothStreamingIsmManifestUri(Uri.parse("http://a.b/c.isml/")))
|
||||
.isEqualTo(Uri.parse("http://a.b/c.isml/Manifest"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fixSmoothStreamingIsmManifestUri_doesNotAlterManifestUri() {
|
||||
assertThat(Util.fixSmoothStreamingIsmManifestUri(Uri.parse("http://a.b/c.ism/Manifest")))
|
||||
.isEqualTo(Uri.parse("http://a.b/c.ism/Manifest"));
|
||||
assertThat(Util.fixSmoothStreamingIsmManifestUri(Uri.parse("http://a.b/c.isml/Manifest")))
|
||||
.isEqualTo(Uri.parse("http://a.b/c.isml/Manifest"));
|
||||
assertThat(
|
||||
Util.fixSmoothStreamingIsmManifestUri(Uri.parse("http://a.b/c.ism/Manifest(filter=x)")))
|
||||
.isEqualTo(Uri.parse("http://a.b/c.ism/Manifest(filter=x)"));
|
||||
assertThat(Util.fixSmoothStreamingIsmManifestUri(Uri.parse("http://a.b/c.ism/Manifest_hd")))
|
||||
.isEqualTo(Uri.parse("http://a.b/c.ism/Manifest_hd"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user