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 | function test_seek11(v, seekTime, is, ok, finish) { |
michael@0 | 2 | |
michael@0 | 3 | // Test for bug 476973, multiple seeks to the same position shouldn't cause problems. |
michael@0 | 4 | |
michael@0 | 5 | var seekedNonZero = false; |
michael@0 | 6 | var completed = false; |
michael@0 | 7 | var target = 0; |
michael@0 | 8 | |
michael@0 | 9 | function startTest() { |
michael@0 | 10 | if (completed) |
michael@0 | 11 | return; |
michael@0 | 12 | target = v.duration / 2; |
michael@0 | 13 | v.currentTime = target; |
michael@0 | 14 | v.currentTime = target; |
michael@0 | 15 | v._seekTarget = target; |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | function startSeeking() { |
michael@0 | 19 | ok(v.currentTime >= v._seekTarget - 0.1, |
michael@0 | 20 | "Video currentTime should be around " + v._seekTarget + ": " + v.currentTime); |
michael@0 | 21 | if (!seekedNonZero) { |
michael@0 | 22 | v.currentTime = target; |
michael@0 | 23 | v._seekTarget = target; |
michael@0 | 24 | seekedNonZero = true; |
michael@0 | 25 | } |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function seekEnded() { |
michael@0 | 29 | if (completed) |
michael@0 | 30 | return; |
michael@0 | 31 | |
michael@0 | 32 | if (v.currentTime > 0) { |
michael@0 | 33 | ok(v.currentTime > target - 0.1 && v.currentTime < target + 0.1, |
michael@0 | 34 | "Seek to wrong destination " + v.currentTime); |
michael@0 | 35 | v.currentTime = 0.0; |
michael@0 | 36 | v._seekTarget = 0.0; |
michael@0 | 37 | } else { |
michael@0 | 38 | ok(seekedNonZero, "Successfully seeked to nonzero"); |
michael@0 | 39 | ok(true, "Seek back to zero was successful"); |
michael@0 | 40 | completed = true; |
michael@0 | 41 | finish(); |
michael@0 | 42 | } |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | v.addEventListener("loadedmetadata", startTest, false); |
michael@0 | 46 | v.addEventListener("seeking", startSeeking, false); |
michael@0 | 47 | v.addEventListener("seeked", seekEnded, false); |
michael@0 | 48 | |
michael@0 | 49 | } |