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

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: applied changes that were uploaded on another CL 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 function runTest()
6 {
7 function prepareVideo(parent)
8 {
9 var video = document.createElement("video");
10 video.src = mediaFile;
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 mediaFile = findMediaFile("video", "content/test");
philipj_slow 2015/09/11 07:17:47 So this actually works because prepareVideo() is i
liberato (no reviews please) 2015/09/11 19:01:42 Done.
23 var parent = document.createElement("div");
24 document.body.appendChild(parent);
25
26 // Require a user gesture, but override it for muted videos.
27 internals.settings.setMediaPlaybackRequiresUserGesture(true);
28 internals.settings.setAutoplayExperimentMode("enabled-forvideo-ifmuted");
29
30 var videoShouldPlay = prepareVideo(parent);
31 var videoShouldNotPlay = prepareVideo(parent);
32
33 // Pause() will clear the autoplaying flag, which should also prevent the
34 // gesture override experiment from autoplaying.
35 videoShouldNotPlay.pause();
36
37 // Mute them both, and see if only one starts.
38 videoShouldPlay.muted = true;
39 videoShouldNotPlay.muted = true;
40 logResult(didPlaybackStart(videoShouldPlay), "First video should play");
41 logResult(!didPlaybackStart(videoShouldNotPlay), "Second video should not pl ay");
42 testRunner.notifyDone();
43 }
44
45 </script>
46 <p>Test that the autoplay experiment doesn't play media once the media
47 is no longer eligible for autoplay.</p>
48 <body onLoad="runTest()">
49 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/video-autoplay-experiment-just-once-expected.txt » ('j') | Source/core/html/HTMLMediaElement.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698