Index: third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html |
diff --git a/third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html b/third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html |
index 366de2d895fea620f3f827d3d9c8f63cc6bad212..4d147015f0c1a958a7e745a54d9d61b0fdaf1267 100644 |
--- a/third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html |
+++ b/third_party/WebKit/LayoutTests/media/media-controls-invalid-url.html |
@@ -1,71 +1,36 @@ |
<!DOCTYPE html> |
-<html> |
- <head> |
- <script src=media-file.js></script> |
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
- (Please avoid writing new tests using video-test.js) --> |
- <script src=video-test.js></script> |
- <script src=media-controls.js></script> |
- <script> |
- var video; |
- |
- function init() |
- { |
- video = document.getElementsByTagName("video")[0]; |
- video.src = findMediaFile("video", "content/test"); |
- |
- waitForEventOnce("canplaythrough", start); |
- waitForEvent("seeked", seeked); |
- waitForEvent("error", error); |
- } |
- |
- function getTimeLineValue() |
- { |
- return mediaControlsButton(video, "timeline").value; |
- } |
- |
- function error() |
- { |
- try { |
- testExpected("getTimeLineValue()", video.currentTime); |
- endTest(); |
- } catch (exception) { |
- failTest(exception.description); |
- } |
- } |
- |
- function seeked() |
- { |
- try { |
- testExpected("getTimeLineValue()", video.currentTime); |
- } catch (exception) { |
- failTest(exception.description); |
- } |
- |
- // Change video source to an invalid one |
- video.src = "/invalid.mov"; |
- } |
- |
- function start() |
- { |
- if (!window.testRunner) |
- return; |
- |
- try { |
- testExpected("getTimeLineValue()", video.currentTime); |
- } catch (exception) { |
- failTest(exception.description); |
- } |
- |
- // Seeking to time value 1.0 |
- video.currentTime = 1.0; |
- } |
- </script> |
- </head> |
- <body onload="init()"> |
- <p>This tests that media element controls are reset to their default state when the src is changed to an invalid url.</p> |
- <p>This test only runs in DRT!</p> |
- <video controls></video> |
- <div id="console"></div> |
- </body> |
-</html> |
+<title>This tests that media element controls are reset to their default state when the src is changed to an invalid url.</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="media-file.js"></script> |
+<script src="media-controls.js"></script> |
+<video></video> |
+<script> |
+async_test(function(t) { |
+ var video = document.querySelector("video"); |
+ video.src = findMediaFile("video", "content/test"); |
+ |
+ video.oncanplaythrough = t.step_func(function() { |
+ video.oncanplaythrough = null; |
+ assert_equals(getTimeLineValue(), video.currentTime); |
Srirama
2016/06/01 20:21:22
Should we compare with 0 instead of video.currentT
foolip
2016/06/02 09:37:03
If there are other tests that verify how and when
Srirama
2016/06/02 13:29:37
Done.
|
+ // Seeking to time value 1.0 |
+ video.currentTime = 1.0; |
+ }); |
+ |
+ video.onseeked = t.step_func(function() { |
+ assert_equals(getTimeLineValue(), video.currentTime); |
+ // Change video source to an invalid one |
+ video.src = "/invalid.mov"; |
+ |
+ }); |
+ |
+ video.onerror = t.step_func_done(function() { |
+ assert_equals(getTimeLineValue(), video.currentTime); |
+ }); |
+ |
+ function getTimeLineValue() { |
foolip
2016/06/02 09:37:04
This capitalization is too weird, and it's MediaCo
Srirama
2016/06/02 13:29:37
Done.
|
+ var timeStr = mediaControlsButton(video, "timeline").value; |
+ return parseInt(timeStr); |
foolip
2016/06/02 09:37:03
parseInt('1.5') return 1, so it's not obvious if t
Srirama
2016/06/02 13:29:37
Done.
|
+ } |
+}); |
+</script> |