2 function buttonClickHandler()
4 var movie = movieInfo.movies[movieInfo.current];
6 consoleWrite("EVENT(mouseup)");
8 consoleWrite("* event handler triggered by user gesture");
10 // Try to enter fullscreen in response to a mouse click
13 run("mediaElement.webkitEnterFullScreen()");
15 if (movie.type == 'video')
16 testException("mediaElement.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR");
21 function clickEnterFullscreenButton()
23 consoleWrite("* clicking on button");
24 var button = document.getElementById('button');
25 eventSender.mouseMoveTo(button.offsetLeft + 20, button.offsetTop + 7);
26 eventSender.mouseDown();
27 eventSender.mouseUp();
30 function fullscreenchange()
32 if (document.webkitIsFullScreen)
38 function beginfullscreen()
40 testExpected("mediaElement.webkitDisplayingFullscreen", true);
41 run("mediaElement.webkitExitFullScreen()");
44 function endfullscreen()
46 setTimeout(openNextMovie, 10);
49 function canplaythrough()
51 var movie = movieInfo.movies[movieInfo.current];
53 consoleWrite("* event handler NOT triggered by a user gesture");
55 if (movie.type == 'video') {
56 testExpected("mediaElement.webkitSupportsFullscreen", movie.supportsFS);
57 testExpected("mediaElement.webkitDisplayingFullscreen", false);
59 testExpected("mediaElement.webkitSupportsFullscreen", undefined);
60 testExpected("mediaElement.webkitDisplayingFullscreen", undefined);
63 // Verify that we get an exception when trying to enter fullscreen since this isn't
64 // called in response to a user gesture.
65 if (movie.type == 'video')
66 testException("mediaElement.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR");
68 // Click on the button
69 if (window.testRunner)
70 setTimeout(clickEnterFullscreenButton, 10);
75 function openNextMovie()
80 if (movieInfo.current >= movieInfo.movies.length) {
85 var movie = movieInfo.movies[movieInfo.current];
87 var container = document.getElementById('parent');
89 // Remove the current media element, if any
90 if (container.firstChild)
91 container.removeChild(container.firstChild);
93 var desc = "*** Creating <" + movie.type + "> element with <em>\"" + url + "\"</em> "
94 + (!movie.inline ? "not " : "") + "in the document, should "
95 + (!movie.supportsFS ? "<b>NOT</b> " : "") + "support fullscreen " + movie.description;
98 // Create a new element, maybe insert it into the DOM
99 mediaElement = document.createElement(movie.type);
101 mediaElement = container.appendChild(mediaElement);
103 mediaElement.setAttribute('controls', 'controls');
104 mediaElement.setAttribute('src', url);
110 function addEventListeners(elem)
112 waitForEvent("error");
113 waitForEvent("loadstart");
114 waitForEvent("waiting");
115 waitForEvent("ratechange");
116 waitForEvent("durationchange");
117 waitForEvent("pause");
118 waitForEvent("play");
119 waitForEvent("playing");
121 waitForEvent('canplaythrough', canplaythrough);
123 waitForEvent('webkitbeginfullscreen', beginfullscreen);
124 waitForEvent('webkitendfullscreen', endfullscreen);
125 waitForEvent('webkitfullscreenchange', fullscreenchange);