Index: third_party/WebKit/LayoutTests/media/video-controls-toggling.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-toggling.html b/third_party/WebKit/LayoutTests/media/video-controls-toggling.html |
index e897db8415e7f1d15e8b74c596aa808f7a74f17d..98beb5e706f151ca6bb6d6f7eeb93387cf1feaa0 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-controls-toggling.html |
+++ b/third_party/WebKit/LayoutTests/media/video-controls-toggling.html |
@@ -1,88 +1,49 @@ |
-<html> |
-<head> |
- <title>Test rendering of volume slider of video tag</title> |
- <script src=media-file.js></script> |
- <script src=media-controls.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> |
- var video; |
- var panel; |
- var muteButtonCoordinates; |
- |
- function init() |
- { |
- video = document.getElementsByTagName("video")[0]; |
- video.src = findMediaFile("video", "content/test"); |
- |
- consoleWrite(""); |
- consoleWrite("** Playing the video **"); |
- run("video.play()"); |
- } |
- |
- function test() |
- { |
- panel = mediaControlsButton(video, "panel"); |
- |
- if (window.eventSender) { |
- try { |
- muteButtonCoordinates = mediaControlsButtonCoordinates(video, "mute-button"); |
- } catch (exception) { |
- testRunner.notifyDone(); |
- return; |
- } |
- |
- consoleWrite(""); |
- consoleWrite("** Move mouse somewhere over the panel **"); |
- run("eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1])"); |
- } |
- |
- consoleWrite(""); |
- consoleWrite("** Test that controls are shown when controls attribute is present **"); |
- testExpected("panel.style['display']", 'none', "!="); |
- |
- if (window.eventSender) { |
- consoleWrite(""); |
- consoleWrite("** Move mouse outside the video **"); |
- run("eventSender.mouseMoveTo(video.offsetLeft, video.offsetTop + 2 * video.offsetHeight)"); |
- } |
- |
+<!DOCTYPE html> |
+<title>Test rendering of volume slider of video tag.</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 controls></video> |
+<script> |
+async_test(function(t) { |
+ var panel; |
+ var muteButtonCoordinates; |
+ var video = document.querySelector("video"); |
+ |
+ video.onplay = t.step_func(function() { |
+ panel = mediaControlsButton(video, "panel"); |
+ muteButtonCoordinates = mediaControlsButtonCoordinates(video, "mute-button"); |
+ |
+ // Move mouse somewhere over the panel. |
+ eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1]); |
+ |
+ // Test that controls are shown when controls attribute is present. |
+ assert_not_equals(panel.style["display"], "none"); |
+ |
+ // Move mouse outside the video. |
+ eventSender.mouseMoveTo(video.offsetLeft, video.offsetTop + 2 * video.offsetHeight); |
+ setTimeout(continueTest, controlsFadeOutDurationMs); |
+ }); |
+ |
+ function continueTest() { |
+ if (panel.style["display"] != "none") { |
setTimeout(continueTest, controlsFadeOutDurationMs); |
+ return; |
} |
- function continueTest() |
- { |
- if (panel.style['display'] != 'none') { |
- setTimeout(continueTest, controlsFadeOutDurationMs); |
- return; |
- } |
- |
- consoleWrite(""); |
- consoleWrite("** The controls should have the display property set to none"); |
- testExpected("panel.style['display']", 'none', "=="); |
- |
- consoleWrite(""); |
- consoleWrite("** Remove controls attribute**"); |
- run("video.removeAttribute('controls')"); |
+ // Remove controls attribute. |
+ video.removeAttribute("controls"); |
- consoleWrite(""); |
- consoleWrite("** Move mouse back over the panel **"); |
- run("eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1])"); |
+ // Move mouse back over the panel. |
+ eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1]); |
- consoleWrite(""); |
- consoleWrite("** Video controls should not be shown **"); |
- testExpected("panel.style['display']", 'none', "=="); |
- |
- consoleWrite(""); |
- |
- endTest(); |
- } |
+ // Video controls should not be shown. |
+ assert_equals(panel.style["display"], "none"); |
+ t.done(); |
+ } |
- </script> |
-</head> |
-<body onload="init()"> |
- Tests that showing / hiding video controls uses the sets the display:none property<br> |
- <video onplay="test()" controls></video> |
-</body> |
-</html> |
+ video.src = findMediaFile("video", "content/test"); |
+ video.play(); |
+}); |
+</script> |