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

Side by Side Diff: LayoutTests/fullscreen/full-screen-cancel.html

Issue 462253003: Remove early returns in fullscreen tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 4 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 <body> 1 <body>
2 <script src="full-screen-test.js"></script> 2 <script src="full-screen-test.js"></script>
3 <span></span> 3 <span></span>
4 <script> 4 <script>
5 // Bail out early if the full screen API is not enabled or is missing: 5 var callback;
6 if (Element.prototype.webkitRequestFullScreen == undefined) { 6 var fullscreenChanged = function(event)
7 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined "); 7 {
8 if (callback)
9 callback(event)
10 };
11 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
12
13 var span = document.getElementsByTagName('span')[0];
14
15 var spanEnteredFullScreen = function() {
16 testExpected("document.webkitIsFullScreen", true);
17 testExpected("document.webkitCurrentFullScreenElement", span);
18 callback = cancelledFullScreen;
19 document.webkitCancelFullScreen();
20 };
21
22 var cancelledFullScreen = function() {
23 testExpected("document.webkitIsFullScreen", false);
24 testExpected("document.webkitCurrentFullScreenElement", undefined);
25 callback = failFullScreenTest;
26 document.webkitCancelFullScreen();
27 setTimeout(endTest, 0);
28 };
29
30 var failFullScreenTest = function() {
31 consoleWrite("Should not have received a webkitfullscreenchange event.") ;
8 endTest(); 32 endTest();
9 } else { 33 };
10 var callback;
11 var fullscreenChanged = function(event)
12 {
13 if (callback)
14 callback(event)
15 };
16 waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
17 34
18 var span = document.getElementsByTagName('span')[0]; 35 callback = spanEnteredFullScreen;
19 36 runWithKeyDown(function(){span.webkitRequestFullScreen()});
20 var spanEnteredFullScreen = function() {
21 testExpected("document.webkitIsFullScreen", true);
22 testExpected("document.webkitCurrentFullScreenElement", span);
23 callback = cancelledFullScreen;
24 document.webkitCancelFullScreen();
25 };
26
27 var cancelledFullScreen = function() {
28 testExpected("document.webkitIsFullScreen", false);
29 testExpected("document.webkitCurrentFullScreenElement", undefined);
30 callback = failFullScreenTest;
31 document.webkitCancelFullScreen();
32 setTimeout(endTest, 0);
33 };
34
35 var failFullScreenTest = function() {
36 consoleWrite("Should not have received a webkitfullscreenchange even t.");
37 endTest();
38 };
39
40 callback = spanEnteredFullScreen;
41 runWithKeyDown(function(){span.webkitRequestFullScreen()});
42 }
43 </script> 37 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698