OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>Test that video play does not work unless a user gesture is invol
ved in playing a video</title> | 3 <title>Test that video play does not work unless a user gesture is invol
ved in playing a video</title> |
4 <script src=media-controls.js></script> | 4 <script src=media-controls.js></script> |
5 <script src=media-file.js></script> | 5 <script src=media-file.js></script> |
| 6 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 7 (Please avoid writing new tests using video-test.js) --> |
6 <script src=video-test.js></script> | 8 <script src=video-test.js></script> |
7 <script> | 9 <script> |
8 var userGestureInitiated = 0; | 10 var userGestureInitiated = 0; |
9 if (window.internals) | 11 if (window.internals) |
10 window.internals.settings.setMediaPlaybackRequiresUserGesture(tr
ue); | 12 window.internals.settings.setMediaPlaybackRequiresUserGesture(tr
ue); |
11 | 13 |
12 function click() | 14 function click() |
13 { | 15 { |
14 if (window.eventSender) { | 16 if (window.eventSender) { |
15 var playCoords; | 17 var playCoords; |
16 try { | 18 try { |
17 playCoords = mediaControlsButtonCoordinates(video, "play
-button"); | 19 playCoords = mediaControlsButtonCoordinates(video, "play
-button"); |
18 } catch (exception) { | 20 } catch (exception) { |
19 failTest(exception.description); | 21 failTest(exception.description); |
20 return; | 22 return; |
21 } | 23 } |
22 var x = playCoords[0]; | 24 var x = playCoords[0]; |
23 var y = playCoords[1]; | 25 var y = playCoords[1]; |
24 | 26 |
25 userGestureInitiated = 1; | 27 userGestureInitiated = 1; |
26 eventSender.mouseMoveTo(x, y); | 28 eventSender.mouseMoveTo(x, y); |
27 eventSender.mouseDown(); | 29 eventSender.mouseDown(); |
28 eventSender.mouseUp(); | 30 eventSender.mouseUp(); |
29 } | 31 } |
30 } | 32 } |
31 | 33 |
32 function playing() | 34 function playing() |
33 { | 35 { |
34 if (userGestureInitiated == 0) { | 36 if (userGestureInitiated == 0) { |
(...skipping 30 matching lines...) Expand all Loading... |
65 video.src = findMediaFile("video", "content/test"); | 67 video.src = findMediaFile("video", "content/test"); |
66 } | 68 } |
67 </script> | 69 </script> |
68 </head> | 70 </head> |
69 | 71 |
70 <body onload="start()"> | 72 <body onload="start()"> |
71 <p>Test that video play() does not work unless a user clicked on the play bu
tton.</p> | 73 <p>Test that video play() does not work unless a user clicked on the play bu
tton.</p> |
72 <video controls></video> | 74 <video controls></video> |
73 </body> | 75 </body> |
74 </html> | 76 </html> |
OLD | NEW |