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

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: CL feedback. 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
OLDNEW
(Empty)
1 <script src=media-file.js></script>
2 <script src=video-test.js></script>
3 <script>
4
5 var mediaFile;
6
7 function runTest()
8 {
9 function prepareVideo(parent)
10 {
11 var video = document.createElement("video");
12 video.src = mediaFile;
13 video.autoplay = true;
14 parent.appendChild(video);
15
16 return video;
17 }
18
19 function didPlaybackStart(element)
20 {
21 return !element.paused || element.ended;
22 }
23
24 var mediaFile = findMediaFile("video", "content/test");
25 var parent = document.createElement("div");
26 document.body.appendChild(parent);
27
28 // Require a user gesture, but override it for muted videos.
29 internals.settings.setMediaPlaybackRequiresUserGesture(true);
30 internals.settings.setAutoplayExperimentMode("enabled-forvideo-ifmuted");
31
32 var videoShouldPlay = prepareVideo(parent);
33 var videoShouldNotPlay = prepareVideo(parent);
34
35 // Pause() will clear the autoplaying flag, which should also prevent the
36 // gesture override experiment from autoplaying.
37 videoShouldNotPlay.pause();
38
39 // Mute them both, and see if only one starts.
40 videoShouldPlay.muted = true;
41 videoShouldNotPlay.muted = true;
42 logResult(didPlaybackStart(videoShouldPlay), "First video should play");
43 logResult(!didPlaybackStart(videoShouldNotPlay), "Second video should not pl ay");
44 testRunner.notifyDone();
45 }
46
47 </script>
48 <p>Test that the autoplay experiment doesn't play media once the media
49 is no longer eligible for autoplay.</p>
50 <body onLoad="runTest()">
51 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698