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

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

Issue 2145893003: Remove video-test.js dependency from video-autoplay-experiment-just-once.html (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove video-test.js dependency Created 4 years, 5 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/LayoutTests/media/video-autoplay-experiment-just-once-expected.txt » ('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 5012642aeecf1a80344f409537110c5cabe5f2af..77064e7a8a427c08c1a6ba0dbf4f51bee0a658f2 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
@@ -1,19 +1,15 @@
+<!DOCTYPE html>
<script src=media-file.js></script>
-<!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
- (Please avoid writing new tests using video-test.js) -->
-<script src=video-test.js></script>
<script>
-
-function runTest()
-{
+function runTest() {
var canPlayThroughCount = 0;
var videoShouldPlay;
var videoShouldNotPlay;
testRunner.waitUntilDone();
+ testRunner.dumpAsText();
- function canPlayThrough()
- {
+ function canPlayThrough() {
canPlayThroughCount++;
if (canPlayThroughCount == 2) {
// Pause() will clear the autoplaying flag, which should also prevent the
@@ -23,16 +19,27 @@ function runTest()
// Scroll them into view, and see if they start playing.
parent.scrollIntoView(true);
// TODO(liberato): remove once autoplay gesture override experiment concludes.
- window.internals.triggerAutoplayViewportCheck(videoShouldPlay);
- window.internals.triggerAutoplayViewportCheck(videoShouldNotPlay);
- logResult(didPlaybackStart(videoShouldPlay), "First video should play");
- logResult(!didPlaybackStart(videoShouldNotPlay), "Second video should not play");
+ internals.triggerAutoplayViewportCheck(videoShouldPlay);
+ internals.triggerAutoplayViewportCheck(videoShouldNotPlay);
+ var result;
+ if (didPlaybackStart(videoShouldPlay))
+ result = document.createTextNode("PASS First video is playing");
+ else
+ result = document.createTextNode("FAIL First video isn't playing");
+ document.body.appendChild(result);
+
+ document.body.appendChild(document.createElement("br"));
+
+ if (!didPlaybackStart(videoShouldNotPlay))
+ result = document.createTextNode("PASS Second video isn't playing");
+ else
+ result = document.createTextNode("FAIL Second video is playing");
+ document.body.appendChild(result);
testRunner.notifyDone();
}
}
- function prepareVideo(parent)
- {
+ function prepareVideo(parent) {
var video = document.createElement("video");
video.oncanplaythrough = canPlayThrough;
video.src = findMediaFile("video", "content/test");
@@ -42,8 +49,7 @@ function runTest()
return video;
}
- function didPlaybackStart(element)
- {
+ function didPlaybackStart(element) {
return !element.paused || element.ended;
}
@@ -65,7 +71,6 @@ function runTest()
videoShouldPlay = prepareVideo(parent);
videoShouldNotPlay = prepareVideo(parent);
}
-
</script>
<p>Test that the autoplay experiment doesn't play media once the media
is no longer eligible for autoplay.</p>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-autoplay-experiment-just-once-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698