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

Unified Diff: third_party/WebKit/LayoutTests/media/controls-volume-slider.html

Issue 2021693002: Convert controls-* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 4 years, 7 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/controls-volume-slider.html
diff --git a/third_party/WebKit/LayoutTests/media/controls-volume-slider.html b/third_party/WebKit/LayoutTests/media/controls-volume-slider.html
index 964ff75900a8cee58f4acabad0cd31b07d12d0b2..8b2f9408463a7c9d949283f00ab021c224b8149e 100644
--- a/third_party/WebKit/LayoutTests/media/controls-volume-slider.html
+++ b/third_party/WebKit/LayoutTests/media/controls-volume-slider.html
@@ -1,33 +1,28 @@
-<!doctype html>
-<html>
- <head>
- <title>media controls volume slider</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>
- </head>
- <body>
- <audio controls></audio>
- <script>
- findMediaElement();
- audio.src = findMediaFile("audio", "content/test");
- testExpected("audio.volume", 1);
- waitForEvent("loadedmetadata", function()
- {
- // click the middle of the volume slider
- var coords = mediaControlsButtonCoordinates(audio, "volume-slider");
- eventSender.mouseMoveTo(coords[0], coords[1]);
- eventSender.mouseDown();
- eventSender.mouseMoveTo(coords[0]-1, coords[1]);
- eventSender.mouseMoveTo(coords[0], coords[1]);
- eventSender.mouseUp();
+<!DOCTYPE html>
+<title>media controls volume slider</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>
+<audio controls></audio>
+<script>
+async_test(function(t) {
+ var audio = document.querySelector("audio");
+ audio.src = findMediaFile("audio", "content/test");
+ assert_equals(audio.volume, 1);
- testExpected("audio.volume", 0.4, '>');
- testExpected("audio.volume", 0.6, '<');
- waitForEventAndEnd("volumechange");
- });
- </script>
- </body>
-</html>
+ audio.onloadedmetadata = t.step_func(function() {
+ // click the middle of the volume slider
+ var coords = mediaControlsButtonCoordinates(audio, "volume-slider");
+ eventSender.mouseMoveTo(coords[0], coords[1]);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(coords[0]-1, coords[1]);
+ eventSender.mouseMoveTo(coords[0], coords[1]);
+ eventSender.mouseUp();
+
+ assert_greater_than(audio.volume, 0.4);
+ assert_less_than(audio.volume, 0.6);
+ audio.onvolumechange = t.step_func_done();
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698