Chromium Code Reviews| 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..8ccf99714fa88e8c3f2ae797aca2cde148d71a40 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 () { |
|
fs
2016/06/24 15:43:32
Nit: stray space after "function"
Srirama
2016/06/25 14:39:25
Done.
|
| + 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> |