2 <body onload=
"runTest();">
3 <div>This tests the restrictions to entering full screen mode laid out in section
4.1 of the W3C
4 <a href=
"http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html">Full Screen API
</a></div>
5 <script src=
"full-screen-test.js"></script>
7 var runTest = function() {
8 consoleWrite('"The context object is not in a document."');
9 var div
= document
.createElement('div');
10 waitForEventOnce(document
, 'webkitfullscreenerror', step2
);
11 runWithKeyDown(function(){div
.webkitRequestFullscreen()});
14 var step2 = function() {
15 consoleWrite('"The context object\'s node document, or an ancestor browsing context\'s document does not have the fullscreen enabled flag set."')
16 var iframe
= document
.documentElement
.appendChild(document
.createElement('iframe'));
17 var div
= iframe
.contentDocument
.documentElement
.appendChild(iframe
.contentDocument
.createElement('div'));
19 waitForEventOnce(iframe
.contentDocument
, 'webkitfullscreenerror', step3
);
20 runWithKeyDown(function(){div
.webkitRequestFullscreen()});
23 var step3 = function() {
24 consoleWrite('"The context object\'s node document fullscreen element stack is not empty and its top element is not an ancestor of the context object."');
25 var div
= document
.documentElement
.appendChild(document
.createElement('div'));
26 var div2
= document
.documentElement
.appendChild(document
.createElement('div'));
27 waitForEventOnce(document
, 'webkitfullscreenchange', function() {
28 waitForEventOnce(document
, 'webkitfullscreenerror', function() {
29 waitForEventOnce(document
, 'webkitfullscreenchange', step4
);
30 document
.webkitExitFullscreen();
32 runWithKeyDown(function(){div2
.webkitRequestFullscreen()});
34 runWithKeyDown(function(){div
.webkitRequestFullscreen()});
37 var step4 = function() {
38 consoleWrite('"A descendant browsing context\'s document has a non-empty fullscreen element stack."');
39 var iframe
= document
.documentElement
.appendChild(document
.createElement('iframe'));
40 iframe
.setAttribute('allowfullscreen', 'true');
41 var div
= iframe
.contentDocument
.documentElement
.appendChild(iframe
.contentDocument
.createElement('div'));
42 var div2
= document
.documentElement
.appendChild(document
.createElement('div'));
43 waitForEventOnce(iframe
.contentDocument
, 'webkitfullscreenchange', function() {
44 waitForEventOnce(document
, 'webkitfullscreenerror', function(){
45 waitForEventOnce(iframe
.contentDocument
, 'webkitfullscreenchange', step5
);
46 iframe
.contentDocument
.webkitExitFullscreen();
48 runWithKeyDown(function(){div2
.webkitRequestFullscreen()});
50 runWithKeyDown(function(){div
.webkitRequestFullscreen()});
53 var step5 = function() {
54 consoleWrite('"This algorithm is not allowed to show a pop-up."');
55 var div
= document
.documentElement
.appendChild(document
.createElement('div'));
56 waitForEventOnce(document
, 'webkitfullscreenerror', endTest
);
57 div
.webkitRequestFullscreen();
60 if (typeof(testRunner
) != 'undefined')
61 testRunner
.setPopupBlockingEnabled(true);