Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-double-seek-currentTime.html

Issue 2124223002: Convert video-[loop, double]* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-double-seek-currentTime-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>Test double seek currentTime.</title>
3 <head> 3 <script src="../resources/testharness.js"></script>
4 <script src=media-file.js></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 5 <script src="media-file.js"></script>
6 (Please avoid writing new tests using video-test.js) --> 6 <video></video>
7 <script src=video-test.js></script> 7 <script>
8 <script> 8 // Seek to same time twice and make sure "seeking" is fired twice and that
9 var seekCount = 0; 9 // "seeked" is fired only once with the "currentTime" being the time set.
10 var expectedSeek = 0; 10 async_test(function(t) {
11 var video; 11 var timeToTest = 1.5;
12 var video = document.querySelector("video");
12 13
13 function seeking(e) 14 var watcher = new EventWatcher(t, video, ["loadedmetadata", "seeking", "seek ed"]);
14 { 15 watcher.wait_for("loadedmetadata").then(t.step_func(function() {
15 consoleWrite("seeking " + e.target.currentTime.toFixed(2)); 16 video.currentTime = 1.0;
17 return watcher.wait_for("seeking");
18 })).then(t.step_func(function() {
19 video.currentTime = timeToTest;
20 return watcher.wait_for("seeking");
21 })).then(t.step_func(function() {
22 video.currentTime = timeToTest;
23 return watcher.wait_for("seeking");
24 })).then(t.step_func(function() {
25 return watcher.wait_for("seeked");
26 })).then(t.step_func_done(function() {
27 assert_equals(video.currentTime, timeToTest);
28 }));
16 29
17 doNextSeek(e.target); 30 video.src = findMediaFile("video", "content/test");
18 } 31 });
19 32 </script>
20 function seeked(e)
21 {
22 consoleWrite("seeked " + e.target.currentTime.toFixed(2));
23
24 video = e.target;
25 var now = e.target.currentTime.toFixed(2);
26 var expected = expectedSeek.toFixed(2);
27 if (now != expected) {
28 failTest("Expected " + expectedSeek + " got " + now);
29 return;
30 }
31 endTest();
32 }
33
34 function doNextSeek(video)
35 {
36 consoleWrite("doNextSeek() " + seekCount);
37
38 var newSeekPoint = -1;
39 switch (seekCount) {
40 case 0:
41 newSeekPoint = 1;
42 break;
43 case 1:
44 newSeekPoint = 1.5;
45 break;
46 case 2:
47 newSeekPoint = 1.5;
48 break;
49 };
50
51 if (newSeekPoint >= 0) {
52 consoleWrite('doNextSeek() seeking to ' + newSeekPoint.toFix ed(2));
53 expectedSeek = newSeekPoint;
54 video.currentTime = newSeekPoint;
55 }
56 seekCount++;
57 }
58
59 function loadedmetadata(e)
60 {
61 consoleWrite("loadedmetadata()");
62 doNextSeek(e.target);
63 }
64
65 function onWindowLoad(e)
66 {
67 video = document.getElementById('video');
68
69 video.src = findMediaFile("video", "content/test");
70 video.addEventListener('seeking', seeking);
71 video.addEventListener('seeked', seeked);
72 video.addEventListener('loadedmetadata', loadedmetadata);
73 video.load();
74 }
75
76 window.addEventListener('load', onWindowLoad, false);
77 </script>
78 </head>
79 <body>
80 <video controls id="video"></video>
81 <p>Test currentTime values when setting from seeking event.</p>
82 <br/>
83 </body>
84 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-double-seek-currentTime-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698