content/media/test/test_fragment_noplay.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Media test: fragment tests</title>
michael@0 5 <script type="text/javascript" src="/MochiKit/packed.js"></script>
michael@0 6 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 8 <script type="text/javascript" src="manifest.js"></script>
michael@0 9 <script type="text/javascript" src="fragment_noplay.js"></script>
michael@0 10 </head>
michael@0 11 <body>
michael@0 12 <pre id="test">
michael@0 13 <script class="testbody" type="text/javascript">
michael@0 14
michael@0 15 var manager = new MediaTestManager;
michael@0 16
michael@0 17 // Fragment parameters to try
michael@0 18 var gFragmentParams = [
michael@0 19 // W3C Media fragment tests
michael@0 20 // http://www.w3.org/2008/WebVideo/Fragments/TC/ua-test-cases
michael@0 21 { fragment: "#t=banana", start: null, end: null }, // TC0027-UA
michael@0 22 { fragment: "#t=3,banana", start: null, end: null }, // TC0028-UA
michael@0 23 { fragment: "#t=banana,7", start: null, end: null }, // TC0029-UA
michael@0 24 { fragment: "#t='3'", start: null, end: null }, // TC0030-UA
michael@0 25 { fragment: "#t=3-7", start: null, end: null }, // TC0031-UA
michael@0 26 { fragment: "#t=3:7", start: null, end: null }, // TC0032-UA
michael@0 27 { fragment: "#t=3,7,9", start: null, end: null }, // TC0033-UA
michael@0 28 { fragment: "#t%3D3", start: null, end: null }, // TC0034-UA
michael@0 29 { fragment: "#%74=3", start: 3, end: null }, // TC0035-UA
michael@0 30 { fragment: "#t=%33", start: 3, end: null }, // TC0036-UA
michael@0 31 { fragment: "#t=3%2C7", start: 3, end: 7 }, // TC0037-UA
michael@0 32 { fragment: "#t=%6Ept:3", start: 3, end: null }, // TC0038-UA
michael@0 33 { fragment: "#t=npt%3A3", start: 3, end: null }, // TC0039-UA
michael@0 34 { fragment: "#t=-1,3", start: null, end: null }, // TC0044-UA
michael@0 35 { fragment: "#t=3&", start: 3, end: null }, // TC0051-UA
michael@0 36 { fragment: "#u=12&t=3", start: 3, end: null }, // TC0052-UA
michael@0 37 { fragment: "#t=foo:7&t=npt:3", start: 3, end: null }, // TC0053-UA
michael@0 38 { fragment: "#&&=&=tom&jerry=&t=3&t=meow:0#", start: 3, end: null }, // TC0054-UA
michael@0 39 { fragment: "#t=7&t=3", start: 3, end: null }, // TC0055-UA
michael@0 40 { fragment: "#T=3,7", start: null, end: null }, // TC0058-UA
michael@0 41 { fragment: "#t=", start: null, end: null }, // TC0061-UA
michael@0 42 { fragment: "#t=.", start: null, end: null }, // TC0062-UA
michael@0 43 { fragment: "#t=.0", start: null, end: null }, // TC0063-UA
michael@0 44 { fragment: "#t=0s", start: null, end: null }, // TC0064-UA
michael@0 45 { fragment: "#t=,0s", start: null, end: null }, // TC0065-UA
michael@0 46 { fragment: "#t=0s,0s", start: null, end: null }, // TC0066-UA
michael@0 47 { fragment: "#t=00:00:00s", start: null, end: null }, // TC0067-UA
michael@0 48 { fragment: "#t=s", start: null, end: null }, // TC0068-UA
michael@0 49 { fragment: "#t=npt:", start: null, end: null }, // TC0069-UA
michael@0 50 { fragment: "#t=1e-1:", start: null, end: null }, // TC0070-UA
michael@0 51 { fragment: "#t=00:00:01.1e-1", start: null, end: null }, // TC0071-UA
michael@0 52 { fragment: "#t=3.", start: 3, end: null }, // TC0072-UA
michael@0 53 { fragment: "#t=0:0:0", start: null, end: null }, // TC0073-UA
michael@0 54 { fragment: "#t=0:00:60", start: null, end: null }, // TC0074-UA
michael@0 55 { fragment: "#t=0:01:60", start: null, end: null }, // TC0075-UA
michael@0 56 { fragment: "#t=0:60:00", start: null, end: null }, // TC0076-UA
michael@0 57 { fragment: "#t=0:000:000", start: null, end: null }, // TC0077-UA
michael@0 58 { fragment: "#t=00:00:03,00:00:07", start: 3, end: 7 }, // TC0078-UA
michael@0 59 { fragment: "#t=3,00:00:07", start: 3, end: 7 }, // TC0079-UA
michael@0 60 { fragment: "#t=00:00.", start: null, end: null }, // TC0080-UA
michael@0 61 { fragment: "#t=0:00:00.", start: null, end: null }, // TC0081-UA
michael@0 62 { fragment: "#t=0:00:10e-1", start: null, end: null }, // TC0082-UA
michael@0 63 { fragment: "#t=0:00:60.000", start: null, end: null }, // TC0083-UA
michael@0 64 { fragment: "#t=0:60:00.000", start: null, end: null }, // TC0084-UA
michael@0 65 { fragment: "#t=3,7&t=foo", start: 3, end: 7 }, // TC0085-UA
michael@0 66 { fragment: "#foo&t=3,7", start: 3, end: 7 }, // TC0086-UA
michael@0 67 { fragment: "#t=3,7&foo", start: 3, end: 7 }, // TC0087-UA
michael@0 68 { fragment: "#t=3,7&&", start: 3, end: 7 }, // TC0088-UA
michael@0 69 { fragment: "#&t=3,7", start: 3, end: 7 }, // TC0089-UA
michael@0 70 { fragment: "#&&t=3,7", start: 3, end: 7 }, // TC0090-UA
michael@0 71 { fragment: "#&t=3,7&", start: 3, end: 7 }, // TC0091-UA
michael@0 72 { fragment: "#t%3d10", start: null, end: null }, // TC0092-UA
michael@0 73 { fragment: "#t=10%26", start: null, end: null }, // TC0093-UA
michael@0 74 { fragment: "#&t=3,7,", start: null, end: null } // TC0094-UA
michael@0 75 ];
michael@0 76
michael@0 77 function createTestArray() {
michael@0 78 var tests = [];
michael@0 79 var tmpVid = document.createElement("video");
michael@0 80
michael@0 81 for (var testNum=0; testNum<gFragmentTests.length; testNum++) {
michael@0 82 var test = gFragmentTests[testNum];
michael@0 83 if (!tmpVid.canPlayType(test.type)) {
michael@0 84 continue;
michael@0 85 }
michael@0 86
michael@0 87 for (var fragNum=0; fragNum<gFragmentParams.length; fragNum++) {
michael@0 88 var p = gFragmentParams[fragNum];
michael@0 89 var t = new Object;
michael@0 90 t.name = test.name + p.fragment;
michael@0 91 t.type = test.type;
michael@0 92 t.duration = test.duration;
michael@0 93 t.start = p.start;
michael@0 94 t.end = p.end;
michael@0 95 tests.push(t);
michael@0 96 }
michael@0 97 }
michael@0 98 return tests;
michael@0 99 }
michael@0 100
michael@0 101 function startTest(test, token) {
michael@0 102 var v = document.createElement('video');
michael@0 103 manager.started(token);
michael@0 104 v.preload = "metadata";
michael@0 105 v.src = test.name;
michael@0 106 v.token = token;
michael@0 107 v.controls = true;
michael@0 108 document.body.appendChild(v);
michael@0 109 var name = test.name + " fragment test";
michael@0 110 var localIs = function(name) { return function(a, b, msg) {
michael@0 111 is(a, b, name + ": " + msg);
michael@0 112 }}(name);
michael@0 113 var localOk = function(name) { return function(a, msg) {
michael@0 114 ok(a, name + ": " + msg);
michael@0 115 }}(name);
michael@0 116 var localFinish = function(v, manager) { return function() {
michael@0 117 if (v.parentNode) {
michael@0 118 v.parentNode.removeChild(v);
michael@0 119 }
michael@0 120 manager.finished(v.token);
michael@0 121 }}(v, manager);
michael@0 122 window['test_fragment_noplay'](v, test.start, test.end, localIs, localOk, localFinish);
michael@0 123 }
michael@0 124
michael@0 125 manager.runTests(createTestArray(), startTest);
michael@0 126
michael@0 127 </script>
michael@0 128 </pre>
michael@0 129 </body>
michael@0 130 </html>

mercurial