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 beginfullscreen()
32 testExpected("mediaElement.webkitDisplayingFullscreen", true);
33 run("mediaElement.webkitExitFullScreen()");
36 function endfullscreen()
38 setTimeout(openNextMovie, 10);
41 function canplaythrough()
43 var movie = movieInfo.movies[movieInfo.current];
45 consoleWrite("* event handler NOT triggered by a user gesture");
47 if (movie.type == 'video') {
48 testExpected("mediaElement.webkitSupportsFullscreen", movie.supportsFS);
49 testExpected("mediaElement.webkitDisplayingFullscreen", false);
51 testExpected("mediaElement.webkitSupportsFullscreen", undefined);
52 testExpected("mediaElement.webkitDisplayingFullscreen", undefined);
55 // Verify that we get an exception when trying to enter fullscreen since this isn't
56 // called in response to a user gesture.
57 if (movie.type == 'video')
58 testException("mediaElement.webkitEnterFullScreen()", "DOMException.INVALID_STATE_ERR");
60 // Click on the button
61 if (window.layoutTestController)
62 setTimeout(clickEnterFullscreenButton, 10);
67 function openNextMovie()
72 if (movieInfo.current >= movieInfo.movies.length) {
77 var movie = movieInfo.movies[movieInfo.current];
79 var container = document.getElementById('parent');
81 // Remove the current media element, if any
82 if (container.firstChild)
83 container.removeChild(container.firstChild);
85 var desc = "*** Creating <" + movie.type + "> element with <em>\"" + url + "\"</em> "
86 + (!movie.inline ? "not " : "") + "in the document, should "
87 + (!movie.supportsFS ? "<b>NOT</b> " : "") + "support fullscreen " + movie.description;
90 // Create a new element, maybe insert it into the DOM
91 mediaElement = document.createElement(movie.type);
93 mediaElement = container.appendChild(mediaElement);
95 mediaElement.setAttribute('controls', 'controls');
96 mediaElement.setAttribute('src', url);
102 function addEventListeners(elem)
104 waitForEvent("error");
105 waitForEvent("loadstart");
106 waitForEvent("waiting");
107 waitForEvent("ratechange");
108 waitForEvent("durationchange");
109 waitForEvent("pause");
110 waitForEvent("play");
111 waitForEvent("playing");
113 waitForEvent('canplaythrough', canplaythrough);
115 waitForEvent('webkitbeginfullscreen', beginfullscreen);
116 waitForEvent('webkitendfullscreen', endfullscreen);