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

Unified Diff: third_party/WebKit/LayoutTests/media/no-autoplay-with-user-gesture-requirement.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/no-autoplay-with-user-gesture-requirement.html
diff --git a/third_party/WebKit/LayoutTests/media/no-autoplay-with-user-gesture-requirement.html b/third_party/WebKit/LayoutTests/media/no-autoplay-with-user-gesture-requirement.html
index a25c4a3d30e3dd04250cf9ffa0786bdaf550b8a5..11dba831e9865f6a3303cdf8b1ac692588f21acc 100644
--- a/third_party/WebKit/LayoutTests/media/no-autoplay-with-user-gesture-requirement.html
+++ b/third_party/WebKit/LayoutTests/media/no-autoplay-with-user-gesture-requirement.html
@@ -1,43 +1,22 @@
-<html>
- <head>
- <title>Test that media autoplay should not work if user gesture is required for playback</title>
- <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>
- if (window.internals)
- window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
+<!DOCTYPE html>
+<title>Test that media autoplay should not work if user gesture is required for playback.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<script>
+internals.settings.setMediaPlaybackRequiresUserGesture(true);
+</script>
+<video autoplay></video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ video.src = findMediaFile("video", "content/test");
+ assert_true(video.paused);
- function testPlay()
- {
- failTest("play event should not fire without user gesture.");
- }
+ video.onplay = t.unreached_func();
- function testPaused()
- {
- testExpected("video.paused", true);
- endTest();
- }
-
- function canplaythrough()
- {
- setTimeout(testPaused, 100);
- }
-
- function start()
- {
- findMediaElement();
- video.src = findMediaFile("video", "content/test");
- testExpected("video.paused", true);
- waitForEvent('canplaythrough', canplaythrough);
- waitForEvent('play', testPlay);
- }
- </script>
- </head>
-
- <body onload="start()">
- <p>Test that media autoplay should not work if user gesture is required for playback.</p>
- <video controls autoplay></video>
- </body>
-</html>
+ video.oncanplaythrough = t.step_func(function() {
+ setTimeout(t.step_func_done(function() { assert_true(video.paused); }), 100);
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698