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

Unified Diff: third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html

Issue 2120783002: Convert video-controls* 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html
diff --git a/third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html b/third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html
index eb9de749449bd47ff3505875913e0460ecd90c16..ef9b5817a8090384e87918b8c13cacd56cbc9d83 100644
--- a/third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html
+++ b/third_party/WebKit/LayoutTests/media/video-controls-focus-movement-on-hide.html
@@ -1,38 +1,30 @@
<!DOCTYPE html>
-<html>
-<title>Test focus movement when controls fade out with a button focused</title>
-<!-- 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>
-<p>
-Test that focus moves to the &lt;body>/document when controls fade out with a button focused.
-</p>
-<video controls src="content/test.ogv"></video>
+<title>Test that focus moves to "body" when controls fade out with a button focused.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-controls.js"></script>
+<script src="media-file.js"></script>
+<video controls></video>
<script>
-var controls;
-var video = document.querySelector("video");
+async_test(function(t) {
+ var video = document.querySelector("video");
-video.addEventListener("canplay", function()
-{
- testExpected("document.activeElement", document.body);
+ video.oncanplay = t.step_func(function() {
+ assert_equals(document.activeElement, document.body);
- var playButton = mediaControlsButton(video, "play-button");
- playButton.focus();
- playButton.click();
+ var playButton = mediaControlsButton(video, "play-button");
+ playButton.focus();
+ playButton.click();
- testExpected("document.activeElement", video);
+ assert_equals(document.activeElement, video);
- runAfterHideMediaControlsTimerFired(function()
- {
- controls = mediaControlsButton(video, "panel");
- testExpected("getComputedStyle(controls).opacity", 0);
+ runAfterHideMediaControlsTimerFired(t.step_func_done(function() {
+ var controls = mediaControlsButton(video, "panel");
+ assert_equals(getComputedStyle(controls).opacity, "0");
+ assert_equals(document.activeElement, document.body);
+ }), video);
+ });
- testExpected("document.activeElement", document.body);
-
- consoleWrite("");
- endTest();
- }, video);
+ video.src = findMediaFile("video", "content/test");
});
-
-</script>
+</script>

Powered by Google App Engine
This is Rietveld 408576698