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

Side by Side 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 unified diff | Download patch
OLDNEW
1 <html> 1 <!DOCTYPE html>
2 <head> 2 <title>Test that media autoplay should not work if user gesture is required for playback.</title>
3 <title>Test that media autoplay should not work if user gesture is requi red for playback</title> 3 <script src="../resources/testharness.js"></script>
4 <script src=media-file.js></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 5 <script src="media-file.js"></script>
6 (Please avoid writing new tests using video-test.js) --> 6 <script>
7 <script src=video-test.js></script> 7 internals.settings.setMediaPlaybackRequiresUserGesture(true);
8 <script> 8 </script>
9 if (window.internals) 9 <video autoplay></video>
10 window.internals.settings.setMediaPlaybackRequiresUserGesture(tr ue); 10 <script>
11 async_test(function(t) {
12 var video = document.querySelector("video");
13 video.src = findMediaFile("video", "content/test");
14 assert_true(video.paused);
11 15
12 function testPlay() 16 video.onplay = t.unreached_func();
13 {
14 failTest("play event should not fire without user gesture.");
15 }
16 17
17 function testPaused() 18 video.oncanplaythrough = t.step_func(function() {
18 { 19 setTimeout(t.step_func_done(function() { assert_true(video.paused); }), 100);
19 testExpected("video.paused", true); 20 });
20 endTest(); 21 });
21 } 22 </script>
22
23 function canplaythrough()
24 {
25 setTimeout(testPaused, 100);
26 }
27
28 function start()
29 {
30 findMediaElement();
31 video.src = findMediaFile("video", "content/test");
32 testExpected("video.paused", true);
33 waitForEvent('canplaythrough', canplaythrough);
34 waitForEvent('play', testPlay);
35 }
36 </script>
37 </head>
38
39 <body onload="start()">
40 <p>Test that media autoplay should not work if user gesture is required for playback.</p>
41 <video controls autoplay></video>
42 </body>
43 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698