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

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: rebased. Created 4 years, 11 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
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 dca77347970046b3918ea3bc8286d48a5a6efd8e..90447eb6f4f026312091a5489fcb640770bdd34e 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
@@ -4,9 +4,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);
@@ -26,19 +50,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>

Powered by Google App Engine
This is Rietveld 408576698