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