blob: 9a15be2eee7bacea6ece505241daae7de05b8b24 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>New Window Opener Test</title>
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
layoutTestController.setCanOpenWindows();
}
description(
'This tests that the different arguments given to a new window are honored.<br/>\
Take note that menubar is special and always on in Mac but not in Win.'
);
var args = [ "scrollbars=yes,width=75,height=100"
, "scrollbars=no,width=75,height=100"
, "scrollbars=1,width=75,height=100"
, "scrollbars=0,width=75,height=100"
, "toolbar=yes,width=75,height=100"
, "toolbar=no,width=75,height=100"
, "toolbar=1,width=75,height=100"
, "toolbar=0,width=75,height=100"
, "status=yes,width=75,height=100"
, "status=no,width=75,height=100"
, "status=1,width=75,height=100"
, "status=0,width=75,height=100"
, "menubar=yes,width=75,height=100"
, "menubar=no,width=75,height=100"
, "menubar=1,width=75,height=100"
, "menubar=0,width=75,height=100"
, "location=yes,width=75,height=100"
, "location=no,width=75,height=100"
, "location=1,width=75,height=100"
, "location=0,width=75,height=100"
];
var actual = [ "newWin.scrollbars.visible", "newWin.scrollbars.visible", "newWin.scrollbars.visible", "newWin.scrollbars.visible"
, "newWin.toolbar.visible", "newWin.toolbar.visible", "newWin.toolbar.visible", "newWin.toolbar.visible"
, "newWin.statusbar.visible", "newWin.statusbar.visible", "newWin.statusbar.visible", "newWin.statusbar.visible"
, "newWin.menubar.visible", "newWin.menubar.visible", "newWin.menubar.visible", "newWin.menubar.visible"
, "newWin.locationbar.visible", "newWin.locationbar.visible", "newWin.locationbar.visible", "newWin.locationbar.visible"
];
var expected = [ "true", "false", "true", "false"
, "true", "false", "true", "false"
, "true", "false", "true", "false"
, "true", "isMenubarAlwaysExpected", "true", "isMenubarAlwaysExpected"
, "true", "false", "true", "false"
];
// Since Mac always shows the menu bar we need to special case it, but in
// a way that does not require platform specific results.
var isMacOSX = navigator.userAgent.indexOf("Mac OS X");
var isMenubarAlwaysExpected;
if (isMacOSX != -1)
isMenubarAlwaysExpected = true;
else
isMenubarAlwaysExpected = false;
var testNum = 0;
var lastTest = args.length;
var newWin;
nextTest();
function nextTest() {
if (testNum == lastTest) {
finished();
return;
} else if (testNum == 0) {
debug("");
debug("Scrollbar");
} else if (testNum == 4) {
debug("");
debug("Toolbar");
} else if (testNum == 8) {
debug("");
debug("Statusbar");
} else if (testNum == 12) {
debug("");
debug("Menubar");
} else if (testNum == 16) {
debug("");
debug("Locationbar");
}
//get the next test and run it.
newWin = window.open("../resources/abe.png", "testWindow", args[testNum] );
shouldBe(actual[testNum], expected[testNum]);
++testNum;
closeAndRunNextTest(newWin);
}
function closeAndRunNextTest(winToClose) {
winToClose.close();
setTimeout(doneHandler, 1);
function doneHandler() {
if (winToClose.closed) {
setTimeout(nextTest, 1);
return;
}
setTimeout(doneHandler, 1);
}
}
function finished() {
shouldBeTrue("window.successfullyParsed");
debug('<br><span class="pass">TEST COMPLETE</span>');
if (window.layoutTestController)
layoutTestController.notifyDone();
}
successfullyParsed = true;
</script>
</body>
</html>