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

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

Issue 2094993002: Convert video-volume*, video-width* and viewport* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-volume-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-volume-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698