summaryrefslogtreecommitdiffstats
path: root/test/wpt/tests/mimesniff/media
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 20:56:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 20:56:19 +0000
commit0b6210cd37b68b94252cb798598b12974a20e1c1 (patch)
treee371686554a877842d95aa94f100bee552ff2a8e /test/wpt/tests/mimesniff/media
parentInitial commit. (diff)
downloadnode-undici-upstream.tar.xz
node-undici-upstream.zip
Adding upstream version 5.28.2+dfsg1+~cs23.11.12.3.upstream/5.28.2+dfsg1+_cs23.11.12.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/wpt/tests/mimesniff/media')
-rw-r--r--test/wpt/tests/mimesniff/media/media-sniff.window.js32
-rw-r--r--test/wpt/tests/mimesniff/media/resources/flac.flacbin0 -> 8493 bytes
-rw-r--r--test/wpt/tests/mimesniff/media/resources/make-vectors.sh10
-rw-r--r--test/wpt/tests/mimesniff/media/resources/mp3-raw.mp3bin0 -> 417 bytes
-rw-r--r--test/wpt/tests/mimesniff/media/resources/mp3-with-id3.mp3bin0 -> 644 bytes
-rw-r--r--test/wpt/tests/mimesniff/media/resources/mp4.mp4bin0 -> 1231 bytes
-rw-r--r--test/wpt/tests/mimesniff/media/resources/ogg.oggbin0 -> 3594 bytes
-rw-r--r--test/wpt/tests/mimesniff/media/resources/wav.wavbin0 -> 486 bytes
-rw-r--r--test/wpt/tests/mimesniff/media/resources/webm.webmbin0 -> 877 bytes
9 files changed, 42 insertions, 0 deletions
diff --git a/test/wpt/tests/mimesniff/media/media-sniff.window.js b/test/wpt/tests/mimesniff/media/media-sniff.window.js
new file mode 100644
index 0000000..8e9bf9a
--- /dev/null
+++ b/test/wpt/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/test/wpt/tests/mimesniff/media/resources/flac.flac b/test/wpt/tests/mimesniff/media/resources/flac.flac
new file mode 100644
index 0000000..747ed38
--- /dev/null
+++ b/test/wpt/tests/mimesniff/media/resources/flac.flac
Binary files differ
diff --git a/test/wpt/tests/mimesniff/media/resources/make-vectors.sh b/test/wpt/tests/mimesniff/media/resources/make-vectors.sh
new file mode 100644
index 0000000..2cc0d46
--- /dev/null
+++ b/test/wpt/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/test/wpt/tests/mimesniff/media/resources/mp3-raw.mp3 b/test/wpt/tests/mimesniff/media/resources/mp3-raw.mp3
new file mode 100644
index 0000000..dcc5240
--- /dev/null
+++ b/test/wpt/tests/mimesniff/media/resources/mp3-raw.mp3
Binary files differ
diff --git a/test/wpt/tests/mimesniff/media/resources/mp3-with-id3.mp3 b/test/wpt/tests/mimesniff/media/resources/mp3-with-id3.mp3
new file mode 100644
index 0000000..a6a2451
--- /dev/null
+++ b/test/wpt/tests/mimesniff/media/resources/mp3-with-id3.mp3
Binary files differ
diff --git a/test/wpt/tests/mimesniff/media/resources/mp4.mp4 b/test/wpt/tests/mimesniff/media/resources/mp4.mp4
new file mode 100644
index 0000000..abefb4f
--- /dev/null
+++ b/test/wpt/tests/mimesniff/media/resources/mp4.mp4
Binary files differ
diff --git a/test/wpt/tests/mimesniff/media/resources/ogg.ogg b/test/wpt/tests/mimesniff/media/resources/ogg.ogg
new file mode 100644
index 0000000..ba0b182
--- /dev/null
+++ b/test/wpt/tests/mimesniff/media/resources/ogg.ogg
Binary files differ
diff --git a/test/wpt/tests/mimesniff/media/resources/wav.wav b/test/wpt/tests/mimesniff/media/resources/wav.wav
new file mode 100644
index 0000000..5229388
--- /dev/null
+++ b/test/wpt/tests/mimesniff/media/resources/wav.wav
Binary files differ
diff --git a/test/wpt/tests/mimesniff/media/resources/webm.webm b/test/wpt/tests/mimesniff/media/resources/webm.webm
new file mode 100644
index 0000000..32a4af8
--- /dev/null
+++ b/test/wpt/tests/mimesniff/media/resources/webm.webm
Binary files differ