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

Side by Side Diff: LayoutTests/fullscreen/full-screen-restrictions.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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <body onload="runTest();"> 2 <body onload="runTest();">
3 <div>This tests the restrictions to entering full screen mode laid out in sectio n 4.1 of the W3C 3 <div>This tests the restrictions to entering full screen mode laid out in sectio n 4.1 of the W3C
4 <a href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html">Full Scree n API</a></div> 4 <a href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html">Full Scree n API</a></div>
5 <script src="full-screen-test.js"></script> 5 <script src="full-screen-test.js"></script>
6 <script> 6 <script>
7 // Bail out early if the full screen API is not enabled or is missing: 7 var runTest = function() {
8 if (Element.prototype.webkitRequestFullScreen == undefined) { 8 consoleWrite('"The context object is not in a document."');
9 logResult(false, "Element.prototype.webkitRequestFullScreen == undefined "); 9 var div = document.createElement('div');
10 endTest(); 10 waitForEventOnce(document, 'webkitfullscreenerror', step2);
11 } else { 11 runWithKeyDown(function(){div.webkitRequestFullscreen()});
12 var runTest = function() { 12 };
13 consoleWrite('"The context object is not in a document."');
14 var div = document.createElement('div');
15 waitForEventOnce(document, 'webkitfullscreenerror', step2);
16 runWithKeyDown(function(){div.webkitRequestFullscreen()});
17 };
18 13
19 var step2 = function() { 14 var step2 = function() {
20 consoleWrite('"The context object\'s node document, or an ancestor b rowsing context\'s document does not have the fullscreen enabled flag set."') 15 consoleWrite('"The context object\'s node document, or an ancestor brows ing context\'s document does not have the fullscreen enabled flag set."')
21 var iframe = document.documentElement.appendChild(document.createEle ment('iframe')); 16 var iframe = document.documentElement.appendChild(document.createElement ('iframe'));
22 var div = iframe.contentDocument.documentElement.appendChild(iframe. contentDocument.createElement('div')); 17 var div = iframe.contentDocument.documentElement.appendChild(iframe.cont entDocument.createElement('div'));
23 18
24 waitForEventOnce(iframe.contentDocument, 'webkitfullscreenerror', st ep3); 19 waitForEventOnce(iframe.contentDocument, 'webkitfullscreenerror', step3) ;
25 runWithKeyDown(function(){div.webkitRequestFullscreen()}); 20 runWithKeyDown(function(){div.webkitRequestFullscreen()});
26 }; 21 };
27 22
28 var step3 = function() { 23 var step3 = function() {
29 consoleWrite('"The context object\'s node document fullscreen elemen t stack is not empty and its top element is not an ancestor of the context objec t."'); 24 consoleWrite('"The context object\'s node document fullscreen element st ack is not empty and its top element is not an ancestor of the context object."' );
30 var div = document.documentElement.appendChild(document.createElemen t('div')); 25 var div = document.documentElement.appendChild(document.createElement('d iv'));
31 var div2 = document.documentElement.appendChild(document.createEleme nt('div')); 26 var div2 = document.documentElement.appendChild(document.createElement(' div'));
32 waitForEventOnce(document, 'webkitfullscreenchange', function() { 27 waitForEventOnce(document, 'webkitfullscreenchange', function() {
33 waitForEventOnce(document, 'webkitfullscreenerror', function() { 28 waitForEventOnce(document, 'webkitfullscreenerror', function() {
34 waitForEventOnce(document, 'webkitfullscreenchange', step4); 29 waitForEventOnce(document, 'webkitfullscreenchange', step4);
35 document.webkitExitFullscreen(); 30 document.webkitExitFullscreen();
36 });
37 runWithKeyDown(function(){div2.webkitRequestFullscreen()});
38 }); 31 });
39 runWithKeyDown(function(){div.webkitRequestFullscreen()}); 32 runWithKeyDown(function(){div2.webkitRequestFullscreen()});
40 }; 33 });
34 runWithKeyDown(function(){div.webkitRequestFullscreen()});
35 };
41 36
42 var step4 = function() { 37 var step4 = function() {
43 consoleWrite('"A descendant browsing context\'s document has a non-e mpty fullscreen element stack."'); 38 consoleWrite('"A descendant browsing context\'s document has a non-empty fullscreen element stack."');
44 var iframe = document.documentElement.appendChild(document.createEle ment('iframe')); 39 var iframe = document.documentElement.appendChild(document.createElement ('iframe'));
45 iframe.setAttribute('allowfullscreen', 'true'); 40 iframe.setAttribute('allowfullscreen', 'true');
46 var div = iframe.contentDocument.documentElement.appendChild(iframe. contentDocument.createElement('div')); 41 var div = iframe.contentDocument.documentElement.appendChild(iframe.cont entDocument.createElement('div'));
47 var div2 = document.documentElement.appendChild(document.createEleme nt('div')); 42 var div2 = document.documentElement.appendChild(document.createElement(' div'));
48 waitForEventOnce(iframe.contentDocument, 'webkitfullscreenchange', f unction() { 43 waitForEventOnce(iframe.contentDocument, 'webkitfullscreenchange', funct ion() {
49 waitForEventOnce(document, 'webkitfullscreenerror', function(){ 44 waitForEventOnce(document, 'webkitfullscreenerror', function(){
50 waitForEventOnce(iframe.contentDocument, 'webkitfullscreench ange', step5); 45 waitForEventOnce(iframe.contentDocument, 'webkitfullscreenchange ', step5);
51 iframe.contentDocument.webkitExitFullscreen(); 46 iframe.contentDocument.webkitExitFullscreen();
52 });
53 runWithKeyDown(function(){div2.webkitRequestFullscreen()});
54 }); 47 });
55 runWithKeyDown(function(){div.webkitRequestFullscreen()}); 48 runWithKeyDown(function(){div2.webkitRequestFullscreen()});
56 }; 49 });
50 runWithKeyDown(function(){div.webkitRequestFullscreen()});
51 };
57 52
58 var step5 = function() { 53 var step5 = function() {
59 consoleWrite('"This algorithm is not allowed to show a pop-up."'); 54 consoleWrite('"This algorithm is not allowed to show a pop-up."');
60 var div = document.documentElement.appendChild(document.createElemen t('div')); 55 var div = document.documentElement.appendChild(document.createElement('d iv'));
61 waitForEventOnce(document, 'webkitfullscreenerror', endTest); 56 waitForEventOnce(document, 'webkitfullscreenerror', endTest);
62 div.webkitRequestFullscreen(); 57 div.webkitRequestFullscreen();
63 }; 58 };
64 59
65 if (typeof(testRunner) != 'undefined') 60 if (typeof(testRunner) != 'undefined')
66 testRunner.setPopupBlockingEnabled(true); 61 testRunner.setPopupBlockingEnabled(true);
67 }
68 </script> 62 </script>
OLDNEW
« no previous file with comments | « LayoutTests/fullscreen/full-screen-request-rejected.html ('k') | LayoutTests/fullscreen/full-screen-stacking-context.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698