summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/mimesniff/media
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/mimesniff/media')
-rw-r--r--testing/web-platform/tests/mimesniff/media/media-sniff.window.js32
-rw-r--r--testing/web-platform/tests/mimesniff/media/resources/flac.flacbin0 -> 8493 bytes
-rwxr-xr-xtesting/web-platform/tests/mimesniff/media/resources/make-vectors.sh10
-rw-r--r--testing/web-platform/tests/mimesniff/media/resources/mp3-raw.mp3bin0 -> 417 bytes
-rw-r--r--testing/web-platform/tests/mimesniff/media/resources/mp3-with-id3.mp3bin0 -> 644 bytes
-rw-r--r--testing/web-platform/tests/mimesniff/media/resources/mp4.mp4bin0 -> 1231 bytes
-rw-r--r--testing/web-platform/tests/mimesniff/media/resources/ogg.oggbin0 -> 3594 bytes
-rw-r--r--testing/web-platform/tests/mimesniff/media/resources/wav.wavbin0 -> 486 bytes
-rw-r--r--testing/web-platform/tests/mimesniff/media/resources/webm.webmbin0 -> 877 bytes
9 files changed, 42 insertions, 0 deletions
diff --git a/testing/web-platform/tests/mimesniff/media/media-sniff.window.js b/testing/web-platform/tests/mimesniff/media/media-sniff.window.js
new file mode 100644
index 0000000000..8e9bf9a27e
--- /dev/null
+++ b/testing/web-platform/tests/mimesniff/media/media-sniff.window.js
@@ -0,0 +1,32 @@
+const tests = {
+ "vectors": [
+ "mp3-raw.mp3",
+ "mp3-with-id3.mp3",
+ "flac.flac",
+ "ogg.ogg",
+ "mp4.mp4",
+ "wav.wav",
+ "webm.webm"
+ ],
+ "contentTypes": [
+ "",
+ "bogus/mime",
+ "application/octet-stream",
+ "text/html",
+ "audio/ogg; codec=vorbis",
+ "application/pdf"
+ ]
+};
+
+tests.vectors.forEach(vector => {
+ tests.contentTypes.forEach(type => {
+ async_test(t => {
+ const element = document.createElement("audio");
+ element.src = "resources/" + vector + "?pipe=header(Content-Type,"+type+")"
+
+ element.addEventListener("error", t.unreached_func("No error expected frorm the HTMLMediaElement"));
+ element.addEventListener("loadedmetadata", t.step_func_done());
+ element.load();
+ }, vector + " loads when served with Content-Type " + type);
+ });
+});
diff --git a/testing/web-platform/tests/mimesniff/media/resources/flac.flac b/testing/web-platform/tests/mimesniff/media/resources/flac.flac
new file mode 100644
index 0000000000..747ed382c5
--- /dev/null
+++ b/testing/web-platform/tests/mimesniff/media/resources/flac.flac
Binary files differ
diff --git a/testing/web-platform/tests/mimesniff/media/resources/make-vectors.sh b/testing/web-platform/tests/mimesniff/media/resources/make-vectors.sh
new file mode 100755
index 0000000000..2cc0d463b5
--- /dev/null
+++ b/testing/web-platform/tests/mimesniff/media/resources/make-vectors.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+INPUT=wav.wav
+sox -V -r 44100 -n -b 8 -c 1 wav.wav synth 0.01 sin 330 vol -6db
+ffmpeg -i $INPUT -write_xing 0 -id3v2_version 0 mp3-raw.mp3
+ffmpeg -i $INPUT mp3-with-id3.mp3
+ffmpeg -i $INPUT flac.flac
+ffmpeg -i $INPUT ogg.ogg
+ffmpeg -i $INPUT mp4.mp4
+ffmpeg -i $INPUT webm.webm
diff --git a/testing/web-platform/tests/mimesniff/media/resources/mp3-raw.mp3 b/testing/web-platform/tests/mimesniff/media/resources/mp3-raw.mp3
new file mode 100644
index 0000000000..dcc52405ac
--- /dev/null
+++ b/testing/web-platform/tests/mimesniff/media/resources/mp3-raw.mp3
Binary files differ
diff --git a/testing/web-platform/tests/mimesniff/media/resources/mp3-with-id3.mp3 b/testing/web-platform/tests/mimesniff/media/resources/mp3-with-id3.mp3
new file mode 100644
index 0000000000..a6a2451240
--- /dev/null
+++ b/testing/web-platform/tests/mimesniff/media/resources/mp3-with-id3.mp3
Binary files differ
diff --git a/testing/web-platform/tests/mimesniff/media/resources/mp4.mp4 b/testing/web-platform/tests/mimesniff/media/resources/mp4.mp4
new file mode 100644
index 0000000000..abefb4f71b
--- /dev/null
+++ b/testing/web-platform/tests/mimesniff/media/resources/mp4.mp4
Binary files differ
diff --git a/testing/web-platform/tests/mimesniff/media/resources/ogg.ogg b/testing/web-platform/tests/mimesniff/media/resources/ogg.ogg
new file mode 100644
index 0000000000..ba0b18218b
--- /dev/null
+++ b/testing/web-platform/tests/mimesniff/media/resources/ogg.ogg
Binary files differ
diff --git a/testing/web-platform/tests/mimesniff/media/resources/wav.wav b/testing/web-platform/tests/mimesniff/media/resources/wav.wav
new file mode 100644
index 0000000000..5229388e1e
--- /dev/null
+++ b/testing/web-platform/tests/mimesniff/media/resources/wav.wav
Binary files differ
diff --git a/testing/web-platform/tests/mimesniff/media/resources/webm.webm b/testing/web-platform/tests/mimesniff/media/resources/webm.webm
new file mode 100644
index 0000000000..32a4af895a
--- /dev/null
+++ b/testing/web-platform/tests/mimesniff/media/resources/webm.webm
Binary files differ