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

Side by Side Diff: third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html

Issue 2031783002: Convert media-cont* and media-element* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>This tests that media element controls are reset to their default state w hen the src is changed to an invalid url.</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 <script src="media-controls.js"></script>
7 <script src=video-test.js></script> 7 <video></video>
8 <script src=media-controls.js></script> 8 <script>
9 <script> 9 async_test(function(t) {
10 var video; 10 var video = document.querySelector("video");
11 video.src = findMediaFile("video", "content/test");
11 12
12 function init() 13 video.oncanplaythrough = t.step_func(function() {
13 { 14 video.oncanplaythrough = null;
14 video = document.getElementsByTagName("video")[0]; 15 assert_equals(video.currentTime, 0);
15 video.src = findMediaFile("video", "content/test"); 16 assert_equals(getMediaControlTimelineValue(), 0);
17 // Seeking to time value 1.0
18 video.currentTime = 1.0;
19 });
16 20
17 waitForEventOnce("canplaythrough", start); 21 video.onseeked = t.step_func(function() {
18 waitForEvent("seeked", seeked); 22 assert_equals(video.currentTime, 1);
19 waitForEvent("error", error); 23 assert_equals(getMediaControlTimelineValue(), 1);
20 } 24 // Change video source to an invalid one
25 video.src = "/invalid.mov";
21 26
22 function getTimeLineValue() 27 });
23 {
24 return mediaControlsButton(video, "timeline").value;
25 }
26 28
27 function error() 29 video.onerror = t.step_func_done(function() {
28 { 30 assert_equals(video.currentTime, 0);
29 try { 31 assert_equals(getMediaControlTimelineValue(), 0);
30 testExpected("getTimeLineValue()", video.currentTime); 32 });
31 endTest();
32 } catch (exception) {
33 failTest(exception.description);
34 }
35 }
36 33
37 function seeked() 34 function getMediaControlTimelineValue() {
38 { 35 var timeStr = mediaControlsButton(video, "timeline").value;
39 try { 36 return +timeStr;
40 testExpected("getTimeLineValue()", video.currentTime); 37 }
41 } catch (exception) { 38 });
42 failTest(exception.description); 39 </script>
43 }
44
45 // Change video source to an invalid one
46 video.src = "/invalid.mov";
47 }
48
49 function start()
50 {
51 if (!window.testRunner)
52 return;
53
54 try {
55 testExpected("getTimeLineValue()", video.currentTime);
56 } catch (exception) {
57 failTest(exception.description);
58 }
59
60 // Seeking to time value 1.0
61 video.currentTime = 1.0;
62 }
63 </script>
64 </head>
65 <body onload="init()">
66 <p>This tests that media element controls are reset to their default sta te when the src is changed to an invalid url.</p>
67 <p>This test only runs in DRT!</p>
68 <video controls></video>
69 <div id="console"></div>
70 </body>
71 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698