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

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: 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..07e8e05fcb66c875df5ba1904d234a5eb6415f16 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,24 @@
-<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>
+async_test(function(t) {
+ internals.settings.setMediaPlaybackRequiresUserGesture(true);
+ var video = document.createElement("video");
+ video.autoplay = true;
+ 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();
- }
+ video.oncanplaythrough = t.step_func(function() {
+ setTimeout(t.step_func_done(testPaused), 100);
fs 2016/06/11 18:59:50 Maybe fold testPaused into this as an anonymous fu
Srirama 2016/06/12 09:51:04 Done.
+ });
- 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>
fs 2016/06/11 18:59:50 Previously this test used a <video> in the documen
Srirama 2016/06/12 09:51:04 Done. Problem is we need to execute internals sett
fs 2016/06/12 13:55:39 Acknowledged. I guess an alternate way would be to
Srirama 2016/06/12 15:29:32 Done.
- </body>
-</html>
+ function testPaused() {
+ assert_true(video.paused);
+ }
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698