Tue, 06 Jan 2015 21:39:09 +0100
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: seek 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_play.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. These tests |
michael@0 | 18 | // try playing the video. Tests for other fragment |
michael@0 | 19 | // formats are in test_fragment_noplay.html. |
michael@0 | 20 | var gFragmentParams = [ |
michael@0 | 21 | { fragment: "", start: null, end: null }, |
michael@0 | 22 | { fragment: "#t=,", start: null, end: null }, |
michael@0 | 23 | { fragment: "#t=3,3", start: null, end: null }, |
michael@0 | 24 | { fragment: "#t=7,3", start: null, end: null }, |
michael@0 | 25 | { fragment: "#t=7,15", start: 7, end: null }, |
michael@0 | 26 | { fragment: "#t=15,20", start: 9.287981, end: null }, |
michael@0 | 27 | { fragment: "#t=5", start: 5, end: null }, |
michael@0 | 28 | { fragment: "#t=5.5", start: 5.5, end: null }, |
michael@0 | 29 | { fragment: "#t=5,", start: null, end: null }, |
michael@0 | 30 | { fragment: "#t=,5", start: 0, end: 5, todo: "See bugs 682141 and 720248" }, |
michael@0 | 31 | { fragment: "#t=2.5,5.5", start: 2.5, end: 5.5, todo: "See bugs 682141 and 720248" }, |
michael@0 | 32 | { fragment: "#t=1,2.5", start: 1, end: 2.5, todo: "See bugs 682141 and 720248" }, |
michael@0 | 33 | { fragment: "#t=,15", start: 0, end: null } |
michael@0 | 34 | ]; |
michael@0 | 35 | |
michael@0 | 36 | function createTestArray() { |
michael@0 | 37 | var tests = []; |
michael@0 | 38 | var tmpVid = document.createElement("video"); |
michael@0 | 39 | |
michael@0 | 40 | for (var testNum=0; testNum<gFragmentTests.length; testNum++) { |
michael@0 | 41 | var test = gFragmentTests[testNum]; |
michael@0 | 42 | if (!tmpVid.canPlayType(test.type)) { |
michael@0 | 43 | continue; |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | for (var fragNum=0; fragNum<gFragmentParams.length; fragNum++) { |
michael@0 | 47 | var p = gFragmentParams[fragNum]; |
michael@0 | 48 | var t = new Object; |
michael@0 | 49 | t.name = test.name + p.fragment; |
michael@0 | 50 | t.type = test.type; |
michael@0 | 51 | t.duration = test.duration; |
michael@0 | 52 | t.start = p.start; |
michael@0 | 53 | t.end = p.end; |
michael@0 | 54 | t.todo = p.todo; |
michael@0 | 55 | tests.push(t); |
michael@0 | 56 | } |
michael@0 | 57 | } |
michael@0 | 58 | return tests; |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | function startTest(test, token) { |
michael@0 | 62 | if (test.todo) { |
michael@0 | 63 | todo(false, test.todo); |
michael@0 | 64 | return; |
michael@0 | 65 | } |
michael@0 | 66 | var v = document.createElement('video'); |
michael@0 | 67 | manager.started(token); |
michael@0 | 68 | v.preload = "metadata"; |
michael@0 | 69 | v.src = test.name; |
michael@0 | 70 | v.token = token; |
michael@0 | 71 | v.controls = true; |
michael@0 | 72 | document.body.appendChild(v); |
michael@0 | 73 | var name = test.name + " fragment test"; |
michael@0 | 74 | var localIs = function(name) { return function(a, b, msg) { |
michael@0 | 75 | is(a, b, name + ": " + msg); |
michael@0 | 76 | }}(name); |
michael@0 | 77 | var localOk = function(name) { return function(a, msg) { |
michael@0 | 78 | ok(a, name + ": " + msg); |
michael@0 | 79 | }}(name); |
michael@0 | 80 | var localFinish = function(v, manager) { return function() { |
michael@0 | 81 | if (v.parentNode) { |
michael@0 | 82 | v.parentNode.removeChild(v); |
michael@0 | 83 | } |
michael@0 | 84 | manager.finished(v.token); |
michael@0 | 85 | }}(v, manager); |
michael@0 | 86 | window['test_fragment_play'](v, test.start, test.end, localIs, localOk, localFinish); |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | manager.runTests(createTestArray(), startTest); |
michael@0 | 90 | |
michael@0 | 91 | </script> |
michael@0 | 92 | </pre> |
michael@0 | 93 | </body> |
michael@0 | 94 | </html> |