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

Unified Diff: third_party/WebKit/LayoutTests/media/video-src-invalid-poster.html

Issue 2096223002: Convert video-src-invalid* and video-src-none* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nit 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-src-invalid-poster-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-src-invalid-poster.html
diff --git a/third_party/WebKit/LayoutTests/media/video-src-invalid-poster.html b/third_party/WebKit/LayoutTests/media/video-src-invalid-poster.html
index fa1e0f8ed60e5227036c4d7896ce5e6264346bbd..e56f9ad6c2e8ac8acede7f49bdaae7c2e8ca60ec 100644
--- a/third_party/WebKit/LayoutTests/media/video-src-invalid-poster.html
+++ b/third_party/WebKit/LayoutTests/media/video-src-invalid-poster.html
@@ -1,30 +1,22 @@
-<!-- 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>
-<video poster="content/abe.png">
- <source src="content/bogus" type="bogus">
-</video>
+<!DOCTYPE html>
+<title>Test that media dimensions are equal to poster dimensions when "src" is invalid.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<video poster="content/abe.png"></video>
<script>
- findMediaElement();
+async_test(function(t) {
+ var video = document.querySelector("video");
- function listenForWidthAndHeight(expectedWidth, expectedHeight, callback) {
- if (video.clientWidth == expectedWidth && video.clientHeight == expectedHeight) {
- callback();
- } else {
- // This uses a 20ms sleep loop to accomplish the wait, since the
- // standard specifies no events that fire on poster load or error.
- window.setTimeout(listenForWidthAndHeight, 20, expectedWidth, expectedHeight, callback);
- }
- }
-
- function expected() {
- testExpected("video.clientWidth", 76);
- testExpected("video.clientHeight", 103);
- endTest();
- }
-
- run("video.load()");
- waitForEvent("loadstart", function () {
- listenForWidthAndHeight(76, 103, expected);
+ video.onloadstart = t.step_func(function () {
+ var image = document.createElement("img");
+ image.src = "content/abe.png";
+ // With this we can be reasonably sure that the poster is loaded.
+ image.onload = t.step_func_done(function() {
+ assert_equals(video.clientWidth, 76);
+ assert_equals(video.clientHeight, 103);
+ });
});
-</script>
+
+ video.src = "content/bogus";
+});
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-src-invalid-poster-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698