summaryrefslogtreecommitdiffstats
path: root/dom/media/test/test_mediatrack_parsing_ogg.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /dom/media/test/test_mediatrack_parsing_ogg.html
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/test/test_mediatrack_parsing_ogg.html')
-rw-r--r--dom/media/test/test_mediatrack_parsing_ogg.html72
1 files changed, 72 insertions, 0 deletions
diff --git a/dom/media/test/test_mediatrack_parsing_ogg.html b/dom/media/test/test_mediatrack_parsing_ogg.html
new file mode 100644
index 0000000000..aabd40e2a3
--- /dev/null
+++ b/dom/media/test/test_mediatrack_parsing_ogg.html
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test events of media track interfaces</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <script type="text/javascript" src="manifest.js"></script>
+</head>
+<body>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var manager = new MediaTestManager;
+
+function localCheckMetadata(msg, e) {
+ ok(msg in gOggTrackInfoResults, "File: " + msg + " is in pre-parsed gOggTrackInfoResults list");
+ var r = gOggTrackInfoResults[msg];
+
+ var hasExpectedAudio = r && r.hasOwnProperty("audio_id");
+ var hasExpectedVideo = r && r.hasOwnProperty("video_id");
+
+ var hasParsedAudio = e.audioTracks.length >= 1;
+ var hasParsedVideo = e.videoTracks.length >= 1;
+
+ ok(!(hasExpectedAudio ^ hasParsedAudio), "Check availability of expected/parsed audio");
+ ok(!(hasExpectedVideo ^ hasParsedVideo), "Check availability of expected/parsed video");
+ if (hasParsedAudio) {
+ is(e.audioTracks.length, 1, "The length of audio track should be 1");
+ is(e.audioTracks[0].id, r.audio_id, "File: " + msg + ", Audio track id");
+ is(e.audioTracks[0].kind, r.audio_kind, "File: " + msg + ", Audio track kind");
+ is(e.audioTracks[0].language, r.audio_language, "File: " + msg + ", Audio track language");
+ is(e.audioTracks[0].label, r.audio_label, "File: " + msg + ", Audio track label");
+ }
+ if (hasParsedVideo) {
+ is(e.videoTracks.length, 1, "The length of video track should be 1");
+ is(e.videoTracks[0].id, r.video_id, "File: " + msg + ", Video track id");
+ is(e.videoTracks[0].kind, r.video_kind, "File: " + msg + ", Video track kind");
+ is(e.videoTracks[0].language, r.video_language, "File: " + msg + ", Video track language");
+ is(e.videoTracks[0].label, r.video_label, "File: " + msg + ", Video track label");
+ }
+}
+
+function startTest(test, token) {
+ var v = document.createElement('video');
+ v.preload = "metadata";
+ v.token = token;
+ manager.started(token);
+
+ v.src = test.name;
+ v.name = test.name;
+
+ v.onloadedmetadata = function(evt) {
+ localCheckMetadata(evt.target.name, evt.target);
+ evt.target.finished = true;
+ evt.target.onloadedmetadata = null;
+ removeNodeAndSource(evt.target);
+ manager.finished(evt.target.token);
+ };
+
+ document.body.appendChild(v);
+}
+
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({"set": [["media.track.enabled", true]]},
+ function() {
+ manager.runTests(gMultitrackInfoOggPlayList, startTest);
+ }
+);
+</script>
+</pre>
+</body>
+</html>