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

Side by Side Diff: LayoutTests/media/video-autoplay-experiment-just-once.html

Issue 1179223002: Implement autoplay gesture override experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased. Created 5 years, 3 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
« no previous file with comments | « no previous file | LayoutTests/media/video-autoplay-experiment-just-once-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <script src=media-file.js></script>
2 <script src=video-test.js></script>
3 <script>
4
5 function runTest()
6 {
7 function prepareVideo(parent)
8 {
9 var video = document.createElement("video");
10 video.src = findMediaFile("video", "content/test");
11 video.autoplay = true;
12 parent.appendChild(video);
13
14 return video;
15 }
16
17 function didPlaybackStart(element)
18 {
19 return !element.paused || element.ended;
20 }
21
22 var parent = document.createElement("div");
23 document.body.appendChild(parent);
24
25 // Require a user gesture, but override it for muted videos.
26 internals.settings.setMediaPlaybackRequiresUserGesture(true);
27 internals.settings.setAutoplayExperimentMode("enabled-forvideo-ifmuted");
28
29 var videoShouldPlay = prepareVideo(parent);
30 var videoShouldNotPlay = prepareVideo(parent);
31
32 // Pause() will clear the autoplaying flag, which should also prevent the
33 // gesture override experiment from autoplaying.
34 videoShouldNotPlay.pause();
35
36 // Mute them both, and see if only one starts.
37 videoShouldPlay.muted = true;
38 videoShouldNotPlay.muted = true;
39 logResult(didPlaybackStart(videoShouldPlay), "First video should play");
40 logResult(!didPlaybackStart(videoShouldNotPlay), "Second video should not pl ay");
41 testRunner.notifyDone();
42 }
43
44 </script>
45 <p>Test that the autoplay experiment doesn't play media once the media
46 is no longer eligible for autoplay.</p>
47 <body onLoad="runTest()">
48 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/video-autoplay-experiment-just-once-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698