Commit 4108074a authored by philipj@opera.com's avatar philipj@opera.com

Remove early returns in fullscreen tests

These checks make the tests longer and don't seem particularly useful.

Review URL: https://codereview.chromium.org/462253003

git-svn-id: svn://svn.chromium.org/blink/trunk@180256 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent aa548dcc
<span><object><div>PASS</div></span> <span><object><div>PASS</div></span>
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<script> <script>
if (Element.prototype.webkitRequestFullScreen == undefined) {
} else {
var span = document.getElementsByTagName('span')[0]; var span = document.getElementsByTagName('span')[0];
document.onwebkitfullscreenchange = function(event) { document.onwebkitfullscreenchange = function(event) {
...@@ -12,5 +10,4 @@ ...@@ -12,5 +10,4 @@
}; };
runWithKeyDown(function(){span.webkitRequestFullScreen()}); runWithKeyDown(function(){span.webkitRequestFullScreen()});
}
</script> </script>
...@@ -11,23 +11,21 @@ Test passes if it does not crash. ...@@ -11,23 +11,21 @@ Test passes if it does not crash.
</i> </i>
</summary> </summary>
<script> <script>
if (window.testRunner) if (window.testRunner)
testRunner.dumpAsText(); testRunner.dumpAsText();
if ("webkitRequestFullScreen" in Element.prototype) { var span = document.getElementById('test');
var span = document.getElementById('test'); var fullscreenChangeEvent = function(event) {
var fullscreenChangeEvent = function(event) { if (document.webkitIsFullScreen)
if (document.webkitIsFullScreen) document.webkitCancelFullScreen();
document.webkitCancelFullScreen(); };
};
document.addEventListener('webkitfullscreenchange', fullscreenChangeEvent); document.addEventListener('webkitfullscreenchange', fullscreenChangeEvent);
document.addEventListener('keydown', function () { document.addEventListener('keydown', function () {
span.webkitRequestFullScreen(); span.webkitRequestFullScreen();
}); });
eventSender.keyDown('a'); eventSender.keyDown('a');
}
</script> </script>
</body> </body>
</html> </html>
...@@ -3,42 +3,36 @@ ...@@ -3,42 +3,36 @@
<p>Test that webkitCancelFullScreen only exits one level of fullscreen</p> <p>Test that webkitCancelFullScreen only exits one level of fullscreen</p>
<div><span></span></div> <div><span></span></div>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { function fullscreenChanged(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
function fullscreenChanged(event) waitForEvent(document, "webkitfullscreenchange", fullscreenChanged);
{
if (callback)
callback(event)
};
waitForEvent(document, "webkitfullscreenchange", fullscreenChanged);
var div = document.querySelector("div"); var div = document.querySelector("div");
function divEnteredFullScreen() function divEnteredFullScreen()
{ {
testExpected("document.webkitCurrentFullScreenElement", div); testExpected("document.webkitCurrentFullScreenElement", div);
callback = spanEnteredFullScreen; callback = spanEnteredFullScreen;
runWithKeyDown(function() { span.webkitRequestFullScreen(); }); runWithKeyDown(function() { span.webkitRequestFullScreen(); });
}; };
var span = document.querySelector("span"); var span = document.querySelector("span");
function spanEnteredFullScreen() function spanEnteredFullScreen()
{ {
testExpected("document.webkitCurrentFullScreenElement", span); testExpected("document.webkitCurrentFullScreenElement", span);
callback = cancelledFullScreen; callback = cancelledFullScreen;
document.webkitCancelFullScreen(); document.webkitCancelFullScreen();
}; };
function cancelledFullScreen() function cancelledFullScreen()
{ {
testExpected("document.webkitCurrentFullScreenElement", div); testExpected("document.webkitCurrentFullScreenElement", div);
endTest(); endTest();
}; };
callback = divEnteredFullScreen; callback = divEnteredFullScreen;
runWithKeyDown(function() { div.webkitRequestFullScreen(); }); runWithKeyDown(function() { div.webkitRequestFullScreen(); });
}
</script> </script>
...@@ -2,42 +2,36 @@ ...@@ -2,42 +2,36 @@
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<span></span> <span></span>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
var fullscreenChanged = function(event) waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
{
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var span = document.getElementsByTagName('span')[0]; var span = document.getElementsByTagName('span')[0];
var spanEnteredFullScreen = function() { var spanEnteredFullScreen = function() {
testExpected("document.webkitIsFullScreen", true); testExpected("document.webkitIsFullScreen", true);
testExpected("document.webkitCurrentFullScreenElement", span); testExpected("document.webkitCurrentFullScreenElement", span);
callback = cancelledFullScreen; callback = cancelledFullScreen;
document.webkitCancelFullScreen(); document.webkitCancelFullScreen();
}; };
var cancelledFullScreen = function() { var cancelledFullScreen = function() {
testExpected("document.webkitIsFullScreen", false); testExpected("document.webkitIsFullScreen", false);
testExpected("document.webkitCurrentFullScreenElement", undefined); testExpected("document.webkitCurrentFullScreenElement", undefined);
callback = failFullScreenTest; callback = failFullScreenTest;
document.webkitCancelFullScreen(); document.webkitCancelFullScreen();
setTimeout(endTest, 0); setTimeout(endTest, 0);
}; };
var failFullScreenTest = function() { var failFullScreenTest = function() {
consoleWrite("Should not have received a webkitfullscreenchange event."); consoleWrite("Should not have received a webkitfullscreenchange event.");
endTest(); endTest();
}; };
callback = spanEnteredFullScreen; callback = spanEnteredFullScreen;
runWithKeyDown(function(){span.webkitRequestFullScreen()}); runWithKeyDown(function(){span.webkitRequestFullScreen()});
}
</script> </script>
...@@ -6,13 +6,7 @@ ...@@ -6,13 +6,7 @@
<div id="div1"> <div id="div1">
<script> <script>
var init = function() { var init = function() {
// Bail out early if the full screen API is not enabled or is missing: runWithKeyDown(function() { div1.webkitRequestFullScreen() });
if (Element.prototype.webkitRequestFullScreen == undefined) {
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
runWithKeyDown(function() { div1.webkitRequestFullScreen() });
}
frameset1 = document.createElementNS("http://www.w3.org/1999/xhtml", "frameset"); frameset1 = document.createElementNS("http://www.w3.org/1999/xhtml", "frameset");
document.body.appendChild(frameset1); document.body.appendChild(frameset1);
......
...@@ -5,27 +5,22 @@ ...@@ -5,27 +5,22 @@
<p><a href="https://bugs.webkit.org/show_bug.cgi?id=89785">Bug 89785</a>: REGRESSION(r116446): Crash in RenderBoxModelObject::adjustedPositionRelativeToOffsetParent</p> <p><a href="https://bugs.webkit.org/show_bug.cgi?id=89785">Bug 89785</a>: REGRESSION(r116446): Crash in RenderBoxModelObject::adjustedPositionRelativeToOffsetParent</p>
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<script> <script>
if ("webkitRequestFullScreen" in Element.prototype) { if (!window.testRunner)
if (!window.testRunner) consoleWrite("To manually test this bug, switch to fullscreen. It shouldn't crash.");
consoleWrite("To manually test this bug, switch to fullscreen. It shouldn't crash.");
video = document.getElementsByTagName("video")[0]; video = document.getElementsByTagName("video")[0];
var fullscreenChanged = function(event) var fullscreenChanged = function(event)
{ {
video.offsetLeft; video.offsetLeft;
video.offsetTop; video.offsetTop;
consoleWrite("PASSED, the page didn't crash."); consoleWrite("PASSED, the page didn't crash.");
endTest();
};
document.addEventListener('webkitfullscreenchange', fullscreenChanged);
runWithKeyDown(function () {
video.webkitRequestFullScreen();
});
} else {
consoleWrite("FAILED, couldn't find webkitRequestFullScreen.");
endTest(); endTest();
} };
document.addEventListener('webkitfullscreenchange', fullscreenChanged);
runWithKeyDown(function () {
video.webkitRequestFullScreen();
});
</script> </script>
</body> </body>
</html> </html>
...@@ -7,43 +7,37 @@ ...@@ -7,43 +7,37 @@
</style> </style>
<span></span> <span></span>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
var fullscreenChanged = function(event) waitForEvent(document, "webkitfullscreenchange", fullscreenChanged);
{
if (callback)
callback(event)
};
waitForEvent(document, "webkitfullscreenchange", fullscreenChanged);
var span = document.getElementsByTagName("span")[0]; var span = document.getElementsByTagName("span")[0];
testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)"); testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)"); testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 0)"); testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 0)");
var documentEnteredFullScreen = function(event) { var documentEnteredFullScreen = function(event) {
testExpected("document.webkitCurrentFullScreenElement", document.documentElement); testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)"); testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgba(0, 0, 0, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(0, 255, 0)"); testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(0, 255, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 255)"); testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 255)");
callback = spanEnteredFullScreen; callback = spanEnteredFullScreen;
runWithKeyDown(function(){span.webkitRequestFullScreen()}); runWithKeyDown(function(){span.webkitRequestFullScreen()});
}; };
var spanEnteredFullScreen = function(event) { var spanEnteredFullScreen = function(event) {
testExpected("document.webkitCurrentFullScreenElement", span); testExpected("document.webkitCurrentFullScreenElement", span);
testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgb(0, 255, 0)"); testExpected("document.defaultView.getComputedStyle(span, null).getPropertyValue('background-color')", "rgb(0, 255, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(255, 0, 0)"); testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('background-color')", "rgb(255, 0, 0)");
testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 255)"); testExpected("document.defaultView.getComputedStyle(document.documentElement, null).getPropertyValue('color')", "rgb(0, 0, 255)");
endTest(); endTest();
}; };
callback = documentEnteredFullScreen; callback = documentEnteredFullScreen;
runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()}); runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()});
}
</script> </script>
...@@ -2,39 +2,33 @@ ...@@ -2,39 +2,33 @@
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<span></span> <span></span>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: if (window.testRunner) {
if (Element.prototype.webkitRequestFullScreen == undefined) { testRunner.setCanOpenWindows(true);
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); testRunner.setCloseRemainingWindowsWhenComplete(true);
endTest(); }
} else { var callback;
if (window.testRunner) { var fullscreenChanged = function(event)
testRunner.setCanOpenWindows(true); {
testRunner.setCloseRemainingWindowsWhenComplete(true); if (callback)
} callback(event)
var callback; };
var fullscreenChanged = function(event) waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
{
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var spanEnteredFullScreen = function() { var spanEnteredFullScreen = function() {
testExpected("document.webkitIsFullScreen", true); testExpected("document.webkitIsFullScreen", true);
testExpected("document.webkitCurrentFullScreenElement", span); testExpected("document.webkitCurrentFullScreenElement", span);
callback = cancelledFullScreen; callback = cancelledFullScreen;
testExpected("window.open('about:blank')", null, "!="); testExpected("window.open('about:blank')", null, "!=");
}; };
var cancelledFullScreen = function() { var cancelledFullScreen = function() {
testExpected("document.webkitIsFullScreen", false); testExpected("document.webkitIsFullScreen", false);
testExpected("document.webkitCurrentFullScreenElement", undefined); testExpected("document.webkitCurrentFullScreenElement", undefined);
endTest(); endTest();
}; };
var span = document.getElementsByTagName('span')[0]; var span = document.getElementsByTagName('span')[0];
callback = spanEnteredFullScreen; callback = spanEnteredFullScreen;
runWithKeyDown(function(){span.webkitRequestFullScreen()}); runWithKeyDown(function(){span.webkitRequestFullScreen()});
}
</script> </script>
...@@ -47,8 +47,7 @@ ...@@ -47,8 +47,7 @@
if (window.eventSender) if (window.eventSender)
eventSender.keyDown('a'); eventSender.keyDown('a');
} }
if ("webkitRequestFullScreen" in Element.prototype) window.addEventListener("load", doTest, false);
window.addEventListener("load", doTest, false);
</script> </script>
<body> <body>
<!-- when full screening the iframe, bad should not be visible --> <!-- when full screening the iframe, bad should not be visible -->
......
...@@ -5,16 +5,10 @@ ...@@ -5,16 +5,10 @@
var runPixelTests = true; var runPixelTests = true;
function init() { function init() {
// Bail out early if the full screen API is not enabled or is missing: var iframe = document.getElementById('block1');
if (Element.prototype.webkitRequestFullScreen == undefined) { var element = iframe.contentDocument.documentElement;
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); waitForEventAndEnd(element, 'webkitfullscreenchange');
endTest(); runWithKeyDown(goFullScreen);
} else {
var iframe = document.getElementById('block1');
var element = iframe.contentDocument.documentElement;
waitForEventAndEnd(element, 'webkitfullscreenchange');
runWithKeyDown(goFullScreen);
}
} }
function goFullScreen() { function goFullScreen() {
......
...@@ -3,38 +3,32 @@ ...@@ -3,38 +3,32 @@
<p>This tests that full screen mode does not allow alphanumeric key events. Press space to continue, then press an alphanumeric key, followed by space. <p>This tests that full screen mode does not allow alphanumeric key events. Press space to continue, then press an alphanumeric key, followed by space.
<span></span> <span></span>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
var fullscreenChanged = function(event) waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
{
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var spanEnteredFullScreen = function() {
callback = null;
testExpected("document.webkitIsFullScreen", true);
if (window.testRunner && eventSender.keyDown) {
waitForEvent(document, 'keypress', keyPressed);
eventSender.keyDown('a', []);
eventSender.keyDown(' ', []);
}
};
var keyPressed = function(event) { var spanEnteredFullScreen = function() {
testExpected('event.keyCode', 32); // Space callback = null;
endTest(); testExpected("document.webkitIsFullScreen", true);
document.webkitCancelFullScreen(); if (window.testRunner && eventSender.keyDown) {
waitForEvent(document, 'keypress', keyPressed);
eventSender.keyDown('a', []);
eventSender.keyDown(' ', []);
} }
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged); };
var span = document.getElementsByTagName('span')[0]; var keyPressed = function(event) {
callback = spanEnteredFullScreen; testExpected('event.keyCode', 32); // Space
runWithKeyDown(function(){span.webkitRequestFullScreen()}); endTest();
document.webkitCancelFullScreen();
} }
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var span = document.getElementsByTagName('span')[0];
callback = spanEnteredFullScreen;
runWithKeyDown(function(){span.webkitRequestFullScreen()});
</script> </script>
...@@ -3,35 +3,29 @@ ...@@ -3,35 +3,29 @@
<p>This tests that full screen mode does not allow alphanumeric key events. Press space to continue, then press the 'a' key. <p>This tests that full screen mode does not allow alphanumeric key events. Press space to continue, then press the 'a' key.
<span></span> <span></span>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
var fullscreenChanged = function(event) waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
{
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var spanEnteredFullScreen = function() { var spanEnteredFullScreen = function() {
callback = null; callback = null;
testExpected("document.webkitIsFullScreen", true); testExpected("document.webkitIsFullScreen", true);
if (window.testRunner && eventSender.keyDown) { if (window.testRunner && eventSender.keyDown) {
waitForEvent(document, 'keypress', keyPressed); waitForEvent(document, 'keypress', keyPressed);
eventSender.keyDown('a', []); eventSender.keyDown('a', []);
}
};
var keyPressed = function(event) {
testExpected('event.keyCode', 97); // 'A'
endTest();
} }
};
var span = document.getElementsByTagName('span')[0];
callback = spanEnteredFullScreen; var keyPressed = function(event) {
runWithKeyDown(function(){span.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}); testExpected('event.keyCode', 97); // 'A'
endTest();
} }
var span = document.getElementsByTagName('span')[0];
callback = spanEnteredFullScreen;
runWithKeyDown(function(){span.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)});
</script> </script>
...@@ -6,24 +6,19 @@ PASS. ...@@ -6,24 +6,19 @@ PASS.
<span style="margin-top: 1em;">WebKit didn't crash. <span style="margin-top: 1em;">WebKit didn't crash.
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<script> <script>
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); callback(event)
} else { };
var fullscreenChanged = function(event) waitForEventOnce(document, "webkitfullscreenchange", fullscreenChanged);
{ var span = document.getElementsByTagName('span')[0];
callback(event) var spanEnteredFullScreen = function() {
}; runWithKeyDown(function() { document.documentElement.webkitRequestFullScreen(); });
waitForEventOnce(document, "webkitfullscreenchange", fullscreenChanged); setTimeout("endTest()", 0);
var span = document.getElementsByTagName('span')[0]; };
var spanEnteredFullScreen = function() {
runWithKeyDown(function() { document.documentElement.webkitRequestFullScreen(); });
setTimeout("endTest()", 0);
};
callback = spanEnteredFullScreen; callback = spanEnteredFullScreen;
runWithKeyDown(function() { span.webkitRequestFullScreen(); }); runWithKeyDown(function() { span.webkitRequestFullScreen(); });
}
</script> </script>
</body> </body>
</html> </html>
...@@ -5,13 +5,7 @@ ...@@ -5,13 +5,7 @@
<script src=../media/media-file.js></script> <script src=../media/media-file.js></script>
<script> <script>
var video2 = document.getElementById('video2'); var video2 = document.getElementById('video2');
// Bail out early if the full screen API is not enabled or is missing: waitForEventTestAndEnd(document, 'webkitfullscreenchange', "video2.clientWidth==document.body.clientWidth");
if (Element.prototype.webkitRequestFullScreen == undefined) { runWithKeyDown(function(){video2.webkitRequestFullScreen()});
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
waitForEventTestAndEnd(document, 'webkitfullscreenchange', "video2.clientWidth==document.body.clientWidth");
runWithKeyDown(function(){video2.webkitRequestFullScreen()});
}
</script> </script>
</body> </body>
...@@ -29,38 +29,32 @@ ...@@ -29,38 +29,32 @@
<div id="clear" /> <div id="clear" />
<span id="two">Two</span> <span id="two">Two</span>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
var fullscreenChanged = function(event) document.onwebkitfullscreenchange = fullscreenChanged;
{
if (callback)
callback(event)
};
document.onwebkitfullscreenchange = fullscreenChanged;
var div = document.getElementById("float"); var div = document.getElementById("float");
var divEnteredFullScreen = function() var divEnteredFullScreen = function()
{ {
if (document.webkitCurrentFullScreenElement == div) { if (document.webkitCurrentFullScreenElement == div) {
callback = cancelledFullScreen; callback = cancelledFullScreen;
runWithKeyDown(function(){document.webkitCancelFullScreen()}); runWithKeyDown(function(){document.webkitCancelFullScreen()});
} }
}; };
var cancelledFullScreen = function() var cancelledFullScreen = function()
{ {
if (document.webkitCurrentFullScreenElement == null) { if (document.webkitCurrentFullScreenElement == null) {
callback = null; callback = null;
endTest(); endTest();
} }
}; };
callback = divEnteredFullScreen; callback = divEnteredFullScreen;
runWithKeyDown(function(){div.webkitRequestFullScreen()}); runWithKeyDown(function(){div.webkitRequestFullScreen()});
}
</script> </script>
...@@ -2,44 +2,38 @@ ...@@ -2,44 +2,38 @@
<script> <script>
var runPixelTests = true; var runPixelTests = true;
var init = function() { var init = function() {
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
var fullscreenChanged = function(event) document.onwebkitfullscreenchange = fullscreenChanged;
{
if (callback)
callback(event)
};
document.onwebkitfullscreenchange = fullscreenChanged;
var one = document.getElementById('one'); var one = document.getElementById('one');
var two = document.getElementById('two'); var two = document.getElementById('two');
var three = document.getElementById('three'); var three = document.getElementById('three');
var threeEnteredFullScreen = function(event) { var threeEnteredFullScreen = function(event) {
if (document.webkitCurrentFullScreenElement == three) { if (document.webkitCurrentFullScreenElement == three) {
callback = threeExitedFullScreen; callback = threeExitedFullScreen;
one.removeChild(two); one.removeChild(two);
} }
}; };
var threeExitedFullScreen = function(event) { var threeExitedFullScreen = function(event) {
if (document.webkitCurrentFullScreenElement == null) { if (document.webkitCurrentFullScreenElement == null) {
callback = null; callback = null;
endTest(); endTest();
} }
}; };
callback = threeEnteredFullScreen; callback = threeEnteredFullScreen;
function goFullScreen() { function goFullScreen() {
document.getElementById('three').webkitRequestFullScreen(); document.getElementById('three').webkitRequestFullScreen();
}
runWithKeyDown(goFullScreen);
} }
runWithKeyDown(goFullScreen);
}; };
</script> </script>
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
......
...@@ -15,12 +15,7 @@ function runWithKeyDown(fn) ...@@ -15,12 +15,7 @@ function runWithKeyDown(fn)
} }
function init() { function init() {
// Bail out early if the full screen API is not enabled or is missing: runWithKeyDown(goFullScreen);
if (Element.prototype.webkitRequestFullScreen == undefined) {
alert("Fullscreen API not available.");
} else {
runWithKeyDown(goFullScreen);
}
} }
function goFullScreen() { function goFullScreen() {
......
...@@ -2,35 +2,29 @@ ...@@ -2,35 +2,29 @@
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<div><span></span></div> <div><span></span></div>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
var fullscreenChanged = function(event) waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
{
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var span = document.getElementsByTagName('span')[0]; var span = document.getElementsByTagName('span')[0];
var div = span.parentNode; var div = span.parentNode;
var spanEnteredFullScreen = function(event) { var spanEnteredFullScreen = function(event) {
callback = spanExitedFullScreen; callback = spanExitedFullScreen;
testExpected("document.webkitCurrentFullScreenElement", span); testExpected("document.webkitCurrentFullScreenElement", span);
document.body.removeChild(div); document.body.removeChild(div);
}; };
var spanExitedFullScreen = function(event) { var spanExitedFullScreen = function(event) {
callback = null; callback = null;
testExpected("document.webkitCurrentFullScreenElement", null); testExpected("document.webkitCurrentFullScreenElement", null);
endTest(); endTest();
}; };
callback = spanEnteredFullScreen; callback = spanEnteredFullScreen;
runWithKeyDown(function(){span.webkitRequestFullScreen()}); runWithKeyDown(function(){span.webkitRequestFullScreen()});
}
</script> </script>
...@@ -2,35 +2,29 @@ ...@@ -2,35 +2,29 @@
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<div><span></span></div> <div><span></span></div>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
var fullscreenChanged = function(event) waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
{
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var span = document.getElementsByTagName('span')[0]; var span = document.getElementsByTagName('span')[0];
var div = span.parentNode; var div = span.parentNode;
var spanEnteredFullScreen = function(event) { var spanEnteredFullScreen = function(event) {
callback = spanExitedFullScreen; callback = spanExitedFullScreen;
testExpected("document.webkitCurrentFullScreenElement", span); testExpected("document.webkitCurrentFullScreenElement", span);
div.innerHTML = ""; div.innerHTML = "";
}; };
var spanExitedFullScreen = function(event) { var spanExitedFullScreen = function(event) {
callback = null; callback = null;
testExpected("document.webkitCurrentFullScreenElement", null); testExpected("document.webkitCurrentFullScreenElement", null);
endTest(); endTest();
}; };
callback = spanEnteredFullScreen; callback = spanEnteredFullScreen;
runWithKeyDown(function(){span.webkitRequestFullScreen()}); runWithKeyDown(function(){span.webkitRequestFullScreen()});
}
</script> </script>
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
</div> </div>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing:
if (Element.prototype.webkitRequestFullScreen == undefined) {
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
var callback; var callback;
waitForEvent(document, 'webkitfullscreenchange', function() { waitForEvent(document, 'webkitfullscreenchange', function() {
var one = document.getElementById('one'); var one = document.getElementById('one');
...@@ -23,5 +18,4 @@ if (Element.prototype.webkitRequestFullScreen == undefined) { ...@@ -23,5 +18,4 @@ if (Element.prototype.webkitRequestFullScreen == undefined) {
document.getElementById('fullscreen').webkitRequestFullScreen(); document.getElementById('fullscreen').webkitRequestFullScreen();
} }
runWithKeyDown(goFullScreen); runWithKeyDown(goFullScreen);
}
</script> </script>
...@@ -2,34 +2,28 @@ ...@@ -2,34 +2,28 @@
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<div><span></span></div> <div><span></span></div>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var span = document.getElementsByTagName('span')[0];
var spanEnteredFullScreen = function(event) {
callback = spanExitedFullScreen;
testExpected("document.webkitCurrentFullScreenElement", span);
span.parentNode.removeChild(span);
};
var spanExitedFullScreen = function(event) {
callback = null;
testExpected("document.webkitCurrentFullScreenElement", null);
endTest(); endTest();
} else { };
var callback;
var fullscreenChanged = function(event) callback = spanEnteredFullScreen;
{ runWithKeyDown(function(){span.webkitRequestFullScreen()});
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var span = document.getElementsByTagName('span')[0];
var spanEnteredFullScreen = function(event) {
callback = spanExitedFullScreen;
testExpected("document.webkitCurrentFullScreenElement", span);
span.parentNode.removeChild(span);
};
var spanExitedFullScreen = function(event) {
callback = null;
testExpected("document.webkitCurrentFullScreenElement", null);
endTest();
};
callback = spanEnteredFullScreen;
runWithKeyDown(function(){span.webkitRequestFullScreen()});
}
</script> </script>
...@@ -3,33 +3,31 @@ ...@@ -3,33 +3,31 @@
<body> <body>
<div>a<span>b<div>c</div>d</span>e</div> <div>a<span>b<div>c</div>d</span>e</div>
<script> <script>
// This test turns fullscreen on and off quickly, // This test turns fullscreen on and off quickly,
// then see if it renderes just like as before. // then see if it renderes just like as before.
if ("webkitRequestFullScreen" in Element.prototype) { if (window.testRunner)
if (window.testRunner) testRunner.waitUntilDone();
testRunner.waitUntilDone(); document.body.offsetTop;
document.body.offsetTop; var span = document.getElementsByTagName('span')[0];
var span = document.getElementsByTagName('span')[0];
var fullscreenChangeEvent = function(event) { var fullscreenChangeEvent = function(event) {
if (document.webkitIsFullScreen) { if (document.webkitIsFullScreen) {
setTimeout(function () { setTimeout(function () {
document.webkitCancelFullScreen(); document.webkitCancelFullScreen();
}, 0); }, 0);
} else { } else {
if (window.testRunner) if (window.testRunner)
testRunner.notifyDone(); testRunner.notifyDone();
} }
}; };
document.addEventListener('webkitfullscreenchange', fullscreenChangeEvent); document.addEventListener('webkitfullscreenchange', fullscreenChangeEvent);
document.addEventListener('keydown', function () { document.addEventListener('keydown', function () {
span.webkitRequestFullScreen(); span.webkitRequestFullScreen();
}); });
if (window.eventSender) if (window.eventSender)
eventSender.keyDown('a'); eventSender.keyDown('a');
}
</script> </script>
</body> </body>
</html> </html>
...@@ -2,18 +2,12 @@ ...@@ -2,18 +2,12 @@
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<div>This tests that a full-screen request which is not user-initiated will be rejected. <div>This tests that a full-screen request which is not user-initiated will be rejected.
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: waitForEvent(document, 'webkitfullscreenchange', function() {
if (Element.prototype.webkitRequestFullScreen == undefined) { logResult("Entered full screen.", false);
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); endTest();
endTest(); });
} else { if (testRunner)
waitForEvent(document, 'webkitfullscreenchange', function() { testRunner.setPopupBlockingEnabled(true);
logResult("Entered full screen.", false); waitForEventAndEnd(document, 'webkitfullscreenerror');
endTest(); document.documentElement.webkitRequestFullScreen();
});
if (testRunner)
testRunner.setPopupBlockingEnabled(true);
waitForEventAndEnd(document, 'webkitfullscreenerror');
document.documentElement.webkitRequestFullScreen();
}
</script> </script>
<body> <body>
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: waitForEventTestAndEnd(document, 'webkitfullscreenchange', "document.webkitIsFullScreen==true");
if (Element.prototype.webkitRequestFullScreen == undefined) { runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()});
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
waitForEventTestAndEnd(document, 'webkitfullscreenchange', "document.webkitIsFullScreen==true");
runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()});
}
</script> </script>
...@@ -4,65 +4,59 @@ ...@@ -4,65 +4,59 @@
<a href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html">Full Screen API</a></div> <a href="http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html">Full Screen API</a></div>
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var runTest = function() {
if (Element.prototype.webkitRequestFullScreen == undefined) { consoleWrite('"The context object is not in a document."');
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); var div = document.createElement('div');
endTest(); waitForEventOnce(document, 'webkitfullscreenerror', step2);
} else { runWithKeyDown(function(){div.webkitRequestFullscreen()});
var runTest = function() { };
consoleWrite('"The context object is not in a document."');
var div = document.createElement('div');
waitForEventOnce(document, 'webkitfullscreenerror', step2);
runWithKeyDown(function(){div.webkitRequestFullscreen()});
};
var step2 = function() { var step2 = function() {
consoleWrite('"The context object\'s node document, or an ancestor browsing context\'s document does not have the fullscreen enabled flag set."') consoleWrite('"The context object\'s node document, or an ancestor browsing context\'s document does not have the fullscreen enabled flag set."')
var iframe = document.documentElement.appendChild(document.createElement('iframe')); var iframe = document.documentElement.appendChild(document.createElement('iframe'));
var div = iframe.contentDocument.documentElement.appendChild(iframe.contentDocument.createElement('div')); var div = iframe.contentDocument.documentElement.appendChild(iframe.contentDocument.createElement('div'));
waitForEventOnce(iframe.contentDocument, 'webkitfullscreenerror', step3); waitForEventOnce(iframe.contentDocument, 'webkitfullscreenerror', step3);
runWithKeyDown(function(){div.webkitRequestFullscreen()}); runWithKeyDown(function(){div.webkitRequestFullscreen()});
}; };
var step3 = function() { var step3 = function() {
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."'); 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."');
var div = document.documentElement.appendChild(document.createElement('div')); var div = document.documentElement.appendChild(document.createElement('div'));
var div2 = document.documentElement.appendChild(document.createElement('div')); var div2 = document.documentElement.appendChild(document.createElement('div'));
waitForEventOnce(document, 'webkitfullscreenchange', function() { waitForEventOnce(document, 'webkitfullscreenchange', function() {
waitForEventOnce(document, 'webkitfullscreenerror', function() { waitForEventOnce(document, 'webkitfullscreenerror', function() {
waitForEventOnce(document, 'webkitfullscreenchange', step4); waitForEventOnce(document, 'webkitfullscreenchange', step4);
document.webkitExitFullscreen(); document.webkitExitFullscreen();
});
runWithKeyDown(function(){div2.webkitRequestFullscreen()});
}); });
runWithKeyDown(function(){div.webkitRequestFullscreen()}); runWithKeyDown(function(){div2.webkitRequestFullscreen()});
}; });
runWithKeyDown(function(){div.webkitRequestFullscreen()});
};
var step4 = function() { var step4 = function() {
consoleWrite('"A descendant browsing context\'s document has a non-empty fullscreen element stack."'); consoleWrite('"A descendant browsing context\'s document has a non-empty fullscreen element stack."');
var iframe = document.documentElement.appendChild(document.createElement('iframe')); var iframe = document.documentElement.appendChild(document.createElement('iframe'));
iframe.setAttribute('allowfullscreen', 'true'); iframe.setAttribute('allowfullscreen', 'true');
var div = iframe.contentDocument.documentElement.appendChild(iframe.contentDocument.createElement('div')); var div = iframe.contentDocument.documentElement.appendChild(iframe.contentDocument.createElement('div'));
var div2 = document.documentElement.appendChild(document.createElement('div')); var div2 = document.documentElement.appendChild(document.createElement('div'));
waitForEventOnce(iframe.contentDocument, 'webkitfullscreenchange', function() { waitForEventOnce(iframe.contentDocument, 'webkitfullscreenchange', function() {
waitForEventOnce(document, 'webkitfullscreenerror', function(){ waitForEventOnce(document, 'webkitfullscreenerror', function(){
waitForEventOnce(iframe.contentDocument, 'webkitfullscreenchange', step5); waitForEventOnce(iframe.contentDocument, 'webkitfullscreenchange', step5);
iframe.contentDocument.webkitExitFullscreen(); iframe.contentDocument.webkitExitFullscreen();
});
runWithKeyDown(function(){div2.webkitRequestFullscreen()});
}); });
runWithKeyDown(function(){div.webkitRequestFullscreen()}); runWithKeyDown(function(){div2.webkitRequestFullscreen()});
}; });
runWithKeyDown(function(){div.webkitRequestFullscreen()});
};
var step5 = function() { var step5 = function() {
consoleWrite('"This algorithm is not allowed to show a pop-up."'); consoleWrite('"This algorithm is not allowed to show a pop-up."');
var div = document.documentElement.appendChild(document.createElement('div')); var div = document.documentElement.appendChild(document.createElement('div'));
waitForEventOnce(document, 'webkitfullscreenerror', endTest); waitForEventOnce(document, 'webkitfullscreenerror', endTest);
div.webkitRequestFullscreen(); div.webkitRequestFullscreen();
}; };
if (typeof(testRunner) != 'undefined') if (typeof(testRunner) != 'undefined')
testRunner.setPopupBlockingEnabled(true); testRunner.setPopupBlockingEnabled(true);
}
</script> </script>
...@@ -5,14 +5,8 @@ ...@@ -5,14 +5,8 @@
var runPixelTests = true; var runPixelTests = true;
function init() { function init() {
// Bail out early if the full screen API is not enabled or is missing: waitForEventAndEnd(document, 'webkitfullscreenchange');
if (Element.prototype.webkitRequestFullScreen == undefined) { runWithKeyDown(goFullScreen);
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
waitForEventAndEnd(document, 'webkitfullscreenchange');
runWithKeyDown(goFullScreen);
}
} }
function goFullScreen() { function goFullScreen() {
......
...@@ -2,49 +2,43 @@ ...@@ -2,49 +2,43 @@
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<span></span> <span></span>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var span = document.getElementsByTagName('span')[0];
if (Element.prototype.webkitRequestFullscreen == undefined) {
logResult(false, "Element.prototype.webkitRequestFullscreen == undefined");
endTest();
} else {
var span = document.getElementsByTagName('span')[0];
var documentEnteredFullScreen = function() { var documentEnteredFullScreen = function() {
testExpected("document.webkitCurrentFullScreenElement", document.documentElement); testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
runWithKeyDown(function(){document.documentElement.webkitRequestFullscreen()}); runWithKeyDown(function(){document.documentElement.webkitRequestFullscreen()});
waitForEvent(document, 'webkitfullscreenerror', documentDidNotReenterFullScreen, false, true); waitForEvent(document, 'webkitfullscreenerror', documentDidNotReenterFullScreen, false, true);
}; };
var documentDidNotReenterFullScreen = function() { var documentDidNotReenterFullScreen = function() {
testExpected("document.webkitCurrentFullScreenElement", document.documentElement); testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
runWithKeyDown(function(){span.webkitRequestFullscreen()}); runWithKeyDown(function(){span.webkitRequestFullscreen()});
waitForEvent(document, 'webkitfullscreenchange', spanEnteredFullScreen, false, true); waitForEvent(document, 'webkitfullscreenchange', spanEnteredFullScreen, false, true);
}; };
var spanEnteredFullScreen = function() { var spanEnteredFullScreen = function() {
testExpected("document.webkitCurrentFullScreenElement", span); testExpected("document.webkitCurrentFullScreenElement", span);
runWithKeyDown(function(){span.webkitRequestFullscreen()}); runWithKeyDown(function(){span.webkitRequestFullscreen()});
waitForEvent(document, 'webkitfullscreenerror', spanDidNotReenterFullScreen, false, true); waitForEvent(document, 'webkitfullscreenerror', spanDidNotReenterFullScreen, false, true);
}; };
var spanDidNotReenterFullScreen = function() { var spanDidNotReenterFullScreen = function() {
testExpected("document.webkitCurrentFullScreenElement", span); testExpected("document.webkitCurrentFullScreenElement", span);
waitForEvent(document, 'webkitfullscreenchange', spanExited, false, true); waitForEvent(document, 'webkitfullscreenchange', spanExited, false, true);
document.webkitExitFullscreen(); document.webkitExitFullscreen();
}; };
var spanExited = function() { var spanExited = function() {
testExpected("document.webkitCurrentFullScreenElement", document.documentElement); testExpected("document.webkitCurrentFullScreenElement", document.documentElement);
waitForEvent(document, 'webkitfullscreenchange', documentExited, false, true); waitForEvent(document, 'webkitfullscreenchange', documentExited, false, true);
document.webkitExitFullscreen(); document.webkitExitFullscreen();
}; };
var documentExited = function() { var documentExited = function() {
testExpected("document.webkitCurrentFullScreenElement", undefined); testExpected("document.webkitCurrentFullScreenElement", undefined);
endTest(); endTest();
}; };
runWithKeyDown(function(){document.documentElement.webkitRequestFullscreen()}); runWithKeyDown(function(){document.documentElement.webkitRequestFullscreen()});
waitForEvent(document, 'webkitfullscreenchange', documentEnteredFullScreen, false, true); waitForEvent(document, 'webkitfullscreenchange', documentEnteredFullScreen, false, true);
}
</script> </script>
...@@ -2,20 +2,14 @@ ...@@ -2,20 +2,14 @@
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
<span></span> <span></span>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var span = document.getElementsByTagName("span")[0];
if (Element.prototype.webkitRequestFullScreen == undefined) {
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
var span = document.getElementsByTagName("span")[0];
var spanEnteredFullScreen = function() { var spanEnteredFullScreen = function() {
testExpected("document.webkitCurrentFullScreenElement", span); testExpected("document.webkitCurrentFullScreenElement", span);
waitForEventAndEnd(document, "webkitfullscreenerror"); waitForEventAndEnd(document, "webkitfullscreenerror");
runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()}); runWithKeyDown(function(){document.documentElement.webkitRequestFullScreen()});
}; };
waitForEvent(document, "webkitfullscreenchange", spanEnteredFullScreen); waitForEvent(document, "webkitfullscreenchange", spanEnteredFullScreen);
runWithKeyDown(function(){span.webkitRequestFullScreen()}); runWithKeyDown(function(){span.webkitRequestFullScreen()});
}
</script> </script>
...@@ -23,36 +23,30 @@ ...@@ -23,36 +23,30 @@
<div class="inner">Number 4</div> <div class="inner">Number 4</div>
</div></div> </div></div>
<script> <script>
// Bail out early if the full screen API is not enabled or is missing: var callback;
if (Element.prototype.webkitRequestFullScreen == undefined) { var fullscreenChanged = function(event)
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined"); {
endTest(); if (callback)
} else { callback(event)
var callback; };
var fullscreenChanged = function(event) waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
{
if (callback)
callback(event)
};
waitForEvent(document, 'webkitfullscreenchange', fullscreenChanged);
var div = document.getElementsByTagName('div')[0]; var div = document.getElementsByTagName('div')[0];
var oldHeight = div.offsetHeight; var oldHeight = div.offsetHeight;
var divEnteredFullScreen = function(event) { var divEnteredFullScreen = function(event) {
callback = divExitedFullScreen; callback = divExitedFullScreen;
document.webkitExitFullscreen(); document.webkitExitFullscreen();
}; };
var divExitedFullScreen = function(event) { var divExitedFullScreen = function(event) {
callback = null; callback = null;
testExpected(div.offsetHeight, oldHeight); testExpected(div.offsetHeight, oldHeight);
div.innerHTML = ""; // simplify the text dump div.innerHTML = ""; // simplify the text dump
endTest(); endTest();
}; };
callback = divEnteredFullScreen; callback = divEnteredFullScreen;
runWithKeyDown(function(){div.webkitRequestFullScreen()}); runWithKeyDown(function(){div.webkitRequestFullScreen()});
}
</script> </script>
<button onclick="div.webkitRequestFullScreen()">Enter Fullscreen</button> <button onclick="div.webkitRequestFullScreen()">Enter Fullscreen</button>
...@@ -5,20 +5,14 @@ ...@@ -5,20 +5,14 @@
var runPixelTests = true; var runPixelTests = true;
function init() { function init() {
// Bail out early if the full screen API is not enabled or is missing: document.onwebkitfullscreenchange = function() {
if (Element.prototype.webkitRequestFullScreen == undefined) { document.onwebkitfullscreenchange = endTest;
logResult(false, 'Element.prototype.webkitRequestFullScreen == undefined'); document.webkitCancelFullScreen();
endTest(); };
} else { function goFullScreen() {
document.onwebkitfullscreenchange = function() { document.getElementById('block1').webkitRequestFullScreen();
document.onwebkitfullscreenchange = endTest;
document.webkitCancelFullScreen();
};
function goFullScreen() {
document.getElementById('block1').webkitRequestFullScreen();
}
runWithKeyDown(goFullScreen);
} }
runWithKeyDown(goFullScreen);
} }
</script> </script>
<script src="full-screen-test.js"></script> <script src="full-screen-test.js"></script>
......
...@@ -5,14 +5,8 @@ ...@@ -5,14 +5,8 @@
var runPixelTests = true; var runPixelTests = true;
function init() { function init() {
// Bail out early if the full screen API is not enabled or is missing: waitForEventAndEnd(document, 'webkitfullscreenchange');
if (Element.prototype.webkitRequestFullScreen == undefined) { runWithKeyDown(goFullScreen);
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
waitForEventAndEnd(document, 'webkitfullscreenchange');
runWithKeyDown(goFullScreen);
}
} }
function goFullScreen() { function goFullScreen() {
......
...@@ -6,39 +6,37 @@ ...@@ -6,39 +6,37 @@
</div> </div>
<script> <script>
if ('webkitRequestFullScreen' in Element.prototype) { if (window.testRunner)
if (window.testRunner) testRunner.waitUntilDone();
testRunner.waitUntilDone();
var callback; var callback;
var fullscreenChanged = function(event) var fullscreenChanged = function(event)
{ {
if (callback) if (callback)
callback(event) callback(event)
}; };
document.addEventListener('webkitfullscreenchange', fullscreenChanged); document.addEventListener('webkitfullscreenchange', fullscreenChanged);
document.body.offsetTop; document.body.offsetTop;
var span = document.getElementById('c2'); var span = document.getElementById('c2');
var div = span.parentNode; var div = span.parentNode;
var spanEnteredFullScreen = function(event) { var spanEnteredFullScreen = function(event) {
setTimeout(function () { setTimeout(function () {
span.appendChild(document.createElement('div')); span.appendChild(document.createElement('div'));
callback = function() { callback = function() {
if (window.testRunner) if (window.testRunner)
testRunner.notifyDone(); testRunner.notifyDone();
} }
document.webkitCancelFullScreen(); document.webkitCancelFullScreen();
}, 0); }, 0);
}; };
callback = spanEnteredFullScreen; callback = spanEnteredFullScreen;
document.addEventListener('keydown', function () { document.addEventListener('keydown', function () {
span.webkitRequestFullScreen(); span.webkitRequestFullScreen();
}); });
if (window.eventSender) if (window.eventSender)
eventSender.keyDown('a'); eventSender.keyDown('a');
}
</script> </script>
...@@ -9,13 +9,7 @@ ...@@ -9,13 +9,7 @@
<script> <script>
setSrcById("video", findMediaFile("video", "../media/content/test")); setSrcById("video", findMediaFile("video", "../media/content/test"));
var video = document.getElementById('video'); var video = document.getElementById('video');
// Bail out early if the full screen API is not enabled or is missing: waitForEventTestAndEnd(document, 'webkitfullscreenchange', "video.clientWidth==document.body.clientWidth");
if (Element.prototype.webkitRequestFullScreen == undefined) { runWithKeyDown(function(){video.webkitRequestFullScreen()});
logResult(false, "Element.prototype.webkitRequestFullScreen == undefined");
endTest();
} else {
waitForEventTestAndEnd(document, 'webkitfullscreenchange', "video.clientWidth==document.body.clientWidth");
runWithKeyDown(function(){video.webkitRequestFullScreen()});
}
</script> </script>
</body> </body>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment