Index: third_party/WebKit/LayoutTests/media/video-volume.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-volume.html b/third_party/WebKit/LayoutTests/media/video-volume.html |
index 7e2dc8d5f7dc5c4a426840ee4c38121ed8641f12..a447831a9e9c1d8516845c92272934a4b96b9264 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-volume.html |
+++ b/third_party/WebKit/LayoutTests/media/video-volume.html |
@@ -1,30 +1,33 @@ |
-<video controls></video> |
-<p>Test 'volume' attribute<p> |
-<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> |
+<!DOCTYPE html> |
+<title>Test "volume" attribute.</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="media-file.js"></script> |
+<video></video> |
<script> |
- testExpected("video.volume", 1.0); |
- run("video.volume = 0.5"); |
- testExpected("video.volume", 0.5); |
- run("video.volume = Number.MIN_VALUE"); |
- testExpected("video.volume", Number.MIN_VALUE); |
- run("video.volume = 0"); |
- testExpected("video.volume", 0); |
- testDOMException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR"); |
- testDOMException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR"); |
- testException("video.volume = -Infinity", '"TypeError: Failed to set the \'volume\' property on \'HTMLMediaElement\': The provided double value is non-finite."'); |
- testException("video.volume = Infinity", '"TypeError: Failed to set the \'volume\' property on \'HTMLMediaElement\': The provided double value is non-finite."'); |
- testException("video.volume = NaN", '"TypeError: Failed to set the \'volume\' property on \'HTMLMediaElement\': The provided double value is non-finite."'); |
- video.src = findMediaFile("video", "content/test"); |
- run("video.load()"); |
- waitForEvent("canplaythrough", function () { |
- testExpected("video.volume", 0); |
- run("video.volume = 0.5"); |
- testExpected("video.volume", 0.5); |
- testDOMException("video.volume = 1.5", "DOMException.INDEX_SIZE_ERR"); |
- testDOMException("video.volume = -0.5", "DOMException.INDEX_SIZE_ERR"); |
- endTest(); |
+async_test(function(t) { |
+ var video = document.querySelector("video"); |
+ assert_equals(video.volume, 1.0); |
+ video.volume = 0.5; |
+ assert_equals(video.volume, 0.5); |
+ video.volume = Number.MIN_VALUE; |
+ assert_equals(video.volume, Number.MIN_VALUE); |
+ video.volume = 0; |
+ assert_equals(video.volume, 0); |
+ assert_throws("IndexSizeError", function() { video.volume = 1.5; }); |
+ assert_throws("IndexSizeError", function() { video.volume = -0.5; }); |
+ assert_throws(new TypeError, function() { video.volume = -Infinity; }); |
+ assert_throws(new TypeError, function() { video.volume = Infinity; }); |
+ assert_throws(new TypeError, function() { video.volume = NaN; }); |
+ |
+ video.oncanplaythrough = t.step_func_done(function() { |
+ assert_equals(video.volume, 0); |
+ video.volume = 0.5; |
+ assert_equals(video.volume, 0.5); |
+ assert_throws("IndexSizeError", function() { video.volume = 1.5; }); |
+ assert_throws("IndexSizeError", function() { video.volume = -0.5; }); |
}); |
-</script> |
+ |
+ video.src = findMediaFile("video", "content/test"); |
+}); |
+</script> |