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

Unified Diff: third_party/WebKit/LayoutTests/media/remove-from-document.html

Issue 2065433002: Convert media-source*, no-autoplay* and remove-from* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comment 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
Index: third_party/WebKit/LayoutTests/media/remove-from-document.html
diff --git a/third_party/WebKit/LayoutTests/media/remove-from-document.html b/third_party/WebKit/LayoutTests/media/remove-from-document.html
index 3eb5fde4f2c9532b388900d8d23bde56d4f9ac8b..756b09f5660a761549966e2c941655901a9282bf 100644
--- a/third_party/WebKit/LayoutTests/media/remove-from-document.html
+++ b/third_party/WebKit/LayoutTests/media/remove-from-document.html
@@ -1,37 +1,22 @@
<!DOCTYPE html>
-<html>
-<head>
- <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>
- <script type="text/javascript" charset="utf-8">
- function doSetup()
- {
- video = document.getElementsByTagName('video')[0];
- video.src = findMediaFile("video", "content/test");
- }
+<title>Test that removing a media element from the tree pauses playback but does not unload the media.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<video autoplay></video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ video.src = findMediaFile("video", "content/test");
- function doTest ()
- {
- consoleWrite("EVENT(canplaythrough)");
- testExpected("video.networkState", HTMLMediaElement.NETWORK_EMPTY, "!=");
- testExpected("video.paused", false);
+ video.oncanplaythrough = t.step_func_done(function() {
+ assert_not_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY);
+ assert_false(video.paused);
- run("document.body.removeChild(video)");
+ document.body.removeChild(video);
- testExpected("video.networkState", HTMLMediaElement.NETWORK_EMPTY, "!=");
- testExpected("video.paused", true);
-
- document.body.offsetTop;
- endTest();
- }
-
- window.addEventListener('load', doSetup, false);
- </script>
-</head>
-<body>
- <p>Test that removing a media element from the tree pauses playback but does not unload the media.</p>
- <video controls autoplay oncanplaythrough="doTest()"></video>
-</body>
-</html>
+ assert_not_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY);
+ assert_true(video.paused);
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698