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

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

Issue 191273002: Revert "Remove the HTMLVideoElement-specific prefixed fullscreen API" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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, pause and enterfullscreen does not work unl ess a user gesture is involved 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 <script src=video-test.js></script> 6 <script src=video-test.js></script>
7 <script> 7 <script>
8 var userGestureInitiated = 0; 8 var userGestureInitiated = 0;
9 if (window.internals) 9 if (window.internals)
10 window.internals.settings.setMediaPlaybackRequiresUserGesture(tr ue); 10 window.internals.settings.setMediaPlaybackRequiresUserGesture(tr ue);
11 11
12 function click() 12 function click()
13 { 13 {
(...skipping 20 matching lines...) Expand all
34 if (userGestureInitiated == 0) { 34 if (userGestureInitiated == 0) {
35 failTest("Should not play without user gesture."); 35 failTest("Should not play without user gesture.");
36 } else { 36 } else {
37 run("video.pause()"); 37 run("video.pause()");
38 } 38 }
39 } 39 }
40 40
41 function pause() 41 function pause()
42 { 42 {
43 testExpected("video.paused", true); 43 testExpected("video.paused", true);
44 // Now video.webkitEnterFullScreen() should no longer throw any exception.
45 // However, the video element may not always enter fullscreen. F or example,
46 // chromium uses fullscreen API which still requires user gestur e
47 try {
48 run("video.webkitEnterFullScreen()");
49 } catch(ex) {
50 failTest("video.webkitEnterFullScreen() still requires user gesture.");
51 }
44 endTest(); 52 endTest();
45 } 53 }
46 54
47 function canplaythrough() 55 function canplaythrough()
48 { 56 {
49 consoleWrite(""); 57 consoleWrite("");
50 consoleWrite("* No user gesture initiated"); 58 consoleWrite("* No user gesture initiated");
51 run("video.play()"); 59 run("video.play()");
60 testDOMException("video.webkitEnterFullScreen()", "DOMException. INVALID_STATE_ERR");
52 testExpected("video.paused", true); 61 testExpected("video.paused", true);
53 consoleWrite(""); 62 consoleWrite("");
54 63
55 consoleWrite("* User gesture initiated"); 64 consoleWrite("* User gesture initiated");
56 click(); 65 click();
57 } 66 }
58 67
59 function start() 68 function start()
60 { 69 {
61 findMediaElement(); 70 findMediaElement();
62 waitForEvent('canplaythrough', canplaythrough); 71 waitForEvent('canplaythrough', canplaythrough);
63 waitForEvent('playing', playing); 72 waitForEvent('playing', playing);
64 waitForEvent('pause', pause); 73 waitForEvent('pause', pause);
65 video.src = findMediaFile("video", "content/test"); 74 video.src = findMediaFile("video", "content/test");
66 } 75 }
67 </script> 76 </script>
68 </head> 77 </head>
69 78
70 <body onload="start()"> 79 <body onload="start()">
71 <p>Test that video play() does not work unless a user clicked on the play bu tton.</p> 80 <p>Test that video play(), pause() and webkitEnterFullScreen() should not wo rk unless a user clicked on the play button.</p>
72 <video controls></video> 81 <video controls></video>
73 </body> 82 </body>
74 </html> 83 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698