Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Media test: standalone video documents</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 onload="doTest()"> |
michael@0 | 10 | |
michael@0 | 11 | <pre id="test"> |
michael@0 | 12 | <script class="testbody" type="text/javascript"> |
michael@0 | 13 | |
michael@0 | 14 | var iframes = []; |
michael@0 | 15 | |
michael@0 | 16 | for (var i=0; i<gSmallTests.length; ++i) { |
michael@0 | 17 | var test = gSmallTests[i]; |
michael@0 | 18 | |
michael@0 | 19 | // We can't play WAV files in stand alone documents, so just don't |
michael@0 | 20 | // run the test on non-video content types. |
michael@0 | 21 | var tag = getMajorMimeType(test.type); |
michael@0 | 22 | if (tag != "video" || !document.createElement("video").canPlayType(test.type)) |
michael@0 | 23 | continue; |
michael@0 | 24 | |
michael@0 | 25 | var f = document.createElement("iframe"); |
michael@0 | 26 | f.src = test.name; |
michael@0 | 27 | f._test = test; |
michael@0 | 28 | f.id = "frame" + i; |
michael@0 | 29 | iframes.push(f); |
michael@0 | 30 | document.body.appendChild(f); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | |
michael@0 | 34 | function filename(uri) { |
michael@0 | 35 | return uri.substr(uri.lastIndexOf("/")+1); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | function doTest() |
michael@0 | 39 | { |
michael@0 | 40 | for (var i=0; i<iframes.length; ++i) { |
michael@0 | 41 | var f = document.getElementById(iframes[i].id); |
michael@0 | 42 | var v = f.contentDocument.body.firstChild; |
michael@0 | 43 | is(v.tagName.toLowerCase(), "video", "Is video element"); |
michael@0 | 44 | var src = filename(v.currentSrc); |
michael@0 | 45 | is(src, iframes[i]._test.name, "Name ("+src+") should match ("+iframes[i]._test.name+")"); |
michael@0 | 46 | is(v.controls, true, "Controls set (" + src + ")"); |
michael@0 | 47 | is(v.autoplay, true, "Autoplay set (" + src + ")"); |
michael@0 | 48 | } |
michael@0 | 49 | SimpleTest.finish(); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | if (iframes.length == 0) { |
michael@0 | 53 | todo(false, "No types supported"); |
michael@0 | 54 | } else { |
michael@0 | 55 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | </script> |
michael@0 | 59 | </pre> |
michael@0 | 60 | </body> |
michael@0 | 61 | </html> |