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

Unified Diff: third_party/WebKit/LayoutTests/media/video-autoplay-experiment-just-once.html

Issue 1470153004: Autoplay experiment metric fixes and additions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ...because tests. Created 4 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/video-autoplay-experiment-just-once.html
diff --git a/third_party/WebKit/LayoutTests/media/video-autoplay-experiment-just-once.html b/third_party/WebKit/LayoutTests/media/video-autoplay-experiment-just-once.html
index 425f3956c1fea0067a8e0eed5b90b32c37f772a7..13fbbc4549f8ddcea601b2010aa650510a482b4a 100644
--- a/third_party/WebKit/LayoutTests/media/video-autoplay-experiment-just-once.html
+++ b/third_party/WebKit/LayoutTests/media/video-autoplay-experiment-just-once.html
@@ -6,9 +6,33 @@
function runTest()
{
+ var canPlayThroughCount = 0;
+ var videoShouldPlay;
+ var videoShouldNotPlay;
+
+ testRunner.waitUntilDone();
+
+ function canPlayThrough()
+ {
+ canPlayThroughCount++;
+ if (canPlayThroughCount == 2) {
+ // Pause() will clear the autoplaying flag, which should also prevent the
+ // gesture override experiment from autoplaying.
+ videoShouldNotPlay.pause();
+
+ // Mute them both, and see if only one starts.
+ videoShouldPlay.muted = true;
+ videoShouldNotPlay.muted = true;
+ logResult(didPlaybackStart(videoShouldPlay), "First video should play");
+ logResult(!didPlaybackStart(videoShouldNotPlay), "Second video should not play");
+ testRunner.notifyDone();
+ }
+ }
+
function prepareVideo(parent)
{
var video = document.createElement("video");
+ video.oncanplaythrough = canPlayThrough;
video.src = findMediaFile("video", "content/test");
video.autoplay = true;
parent.appendChild(video);
@@ -28,19 +52,8 @@ function runTest()
internals.settings.setMediaPlaybackRequiresUserGesture(true);
internals.settings.setAutoplayExperimentMode("enabled-forvideo-ifmuted");
- var videoShouldPlay = prepareVideo(parent);
- var videoShouldNotPlay = prepareVideo(parent);
-
- // Pause() will clear the autoplaying flag, which should also prevent the
- // gesture override experiment from autoplaying.
- videoShouldNotPlay.pause();
-
- // Mute them both, and see if only one starts.
- videoShouldPlay.muted = true;
- videoShouldNotPlay.muted = true;
- logResult(didPlaybackStart(videoShouldPlay), "First video should play");
- logResult(!didPlaybackStart(videoShouldNotPlay), "Second video should not play");
- testRunner.notifyDone();
+ videoShouldPlay = prepareVideo(parent);
+ videoShouldNotPlay = prepareVideo(parent);
}
</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698