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

Unified Diff: LayoutTests/media/video-play-require-user-gesture.html

Issue 428263004: Revert of Delete mediaPlaybackRequiresUserGesture (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
Index: LayoutTests/media/video-play-require-user-gesture.html
diff --git a/LayoutTests/media/video-play-require-user-gesture.html b/LayoutTests/media/video-play-require-user-gesture.html
new file mode 100644
index 0000000000000000000000000000000000000000..0e936071238ab2a2c6c1cd2d00fe44c120157d38
--- /dev/null
+++ b/LayoutTests/media/video-play-require-user-gesture.html
@@ -0,0 +1,74 @@
+<html>
+ <head>
+ <title>Test that video play does not work unless a user gesture is involved in playing a video</title>
+ <script src=media-controls.js></script>
+ <script src=media-file.js></script>
+ <script src=video-test.js></script>
+ <script>
+ var userGestureInitiated = 0;
+ if (window.internals)
+ window.internals.settings.setMediaPlaybackRequiresUserGesture(true);
+
+ function click()
+ {
+ if (window.eventSender) {
+ var playCoords;
+ try {
+ playCoords = mediaControlsButtonCoordinates(video, "play-button");
+ } catch (exception) {
+ failTest(exception.description);
+ return;
+ }
+ var x = playCoords[0];
+ var y = playCoords[1];
+
+ userGestureInitiated = 1;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ }
+ }
+
+ function playing()
+ {
+ if (userGestureInitiated == 0) {
+ failTest("Should not play without user gesture.");
+ } else {
+ run("video.pause()");
+ }
+ }
+
+ function pause()
+ {
+ testExpected("video.paused", true);
+ endTest();
+ }
+
+ function canplaythrough()
+ {
+ consoleWrite("");
+ consoleWrite("* No user gesture initiated");
+ run("video.play()");
+ testExpected("video.paused", true);
+ consoleWrite("");
+
+ consoleWrite("* User gesture initiated");
+ click();
+ }
+
+ function start()
+ {
+ findMediaElement();
+ waitForEvent('canplaythrough', canplaythrough);
+ waitForEvent('playing', playing);
+ waitForEvent('pause', pause);
+ video.src = findMediaFile("video", "content/test");
+ }
+ </script>
+ </head>
+
+ <body onload="start()">
+ <p>Test that video play() does not work unless a user clicked on the play button.</p>
+ <video controls></video>
+ </body>
+</html>
« no previous file with comments | « LayoutTests/media/video-capture-preview-expected.txt ('k') | LayoutTests/media/video-play-require-user-gesture-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698