content/media/test/test_playback_errors.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Test playback of media files that should have errors</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 7 <script type="text/javascript" src="manifest.js"></script>
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 <pre id="test">
michael@0 11 <script class="testbody" type="text/javascript">
michael@0 12
michael@0 13 var manager = new MediaTestManager;
michael@0 14
michael@0 15 function startTest(test, token) {
michael@0 16 var v = document.createElement('video');
michael@0 17 manager.started(token);
michael@0 18 v._errorCount = 0;
michael@0 19 v._ignore = false;
michael@0 20 function endedTest(v) {
michael@0 21 if (v._ignore)
michael@0 22 return;
michael@0 23 v._ignore = true;
michael@0 24 v.parentNode.removeChild(v);
michael@0 25 manager.finished(token);
michael@0 26 }
michael@0 27 var checkError = function(test, v) { return function(evt) {
michael@0 28 v._errorCount++;
michael@0 29 is(v._errorCount, 1, test.name + " only one error fired");
michael@0 30 endedTest(v);
michael@0 31 }}(test, v);
michael@0 32 var checkEnded = function(test, v) { return function() {
michael@0 33 ok(false, test.name + " successfully played");
michael@0 34 endedTest(v);
michael@0 35 }}(test, v);
michael@0 36 v.addEventListener("error", checkError, false);
michael@0 37 v.addEventListener("ended", checkEnded, false);
michael@0 38 v.src = test.name;
michael@0 39 document.body.appendChild(v);
michael@0 40 v.play();
michael@0 41 }
michael@0 42
michael@0 43 manager.runTests(gErrorTests, startTest);
michael@0 44
michael@0 45 </script>
michael@0 46 </pre>
michael@0 47 </body>
michael@0 48 </html>

mercurial