diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/media/test/test_mediatrack_parsing_ogg.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/test/test_mediatrack_parsing_ogg.html')
-rw-r--r-- | dom/media/test/test_mediatrack_parsing_ogg.html | 72 |
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 000000000..e98636c2d --- /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 type="text/javascript" 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> |