3 <title>Test that video play does not work unless a user gesture is involved in playing a video
</title>
4 <script src=media-controls.js
></script>
5 <script src=media-file.js
></script>
6 <script src=video-test.js
></script>
8 var userGestureInitiated
= 0;
10 window
.internals
.settings
.setMediaPlaybackRequiresUserGesture(true);
14 if (window
.eventSender
) {
17 playCoords
= mediaControlsButtonCoordinates(video
, "play-button");
19 failTest(exception
.description
);
22 var x
= playCoords
[0];
23 var y
= playCoords
[1];
25 userGestureInitiated
= 1;
26 eventSender
.mouseMoveTo(x
, y
);
27 eventSender
.mouseDown();
28 eventSender
.mouseUp();
34 if (userGestureInitiated
== 0) {
35 failTest("Should not play without user gesture.");
43 testExpected("video.paused", true);
47 function canplaythrough()
50 consoleWrite("* No user gesture initiated");
52 testExpected("video.paused", true);
55 consoleWrite("* User gesture initiated");
62 waitForEvent('canplaythrough', canplaythrough
);
63 waitForEvent('playing', playing
);
64 waitForEvent('pause', pause
);
65 video
.src
= findMediaFile("video", "content/test");
70 <body onload=
"start()">
71 <p>Test that video play() does not work unless a user clicked on the play button.
</p>
72 <video controls
></video>