120 lines
4.5 KiB
HTML
120 lines
4.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<title>New Window Opener Test</title>
|
|
<script src="../../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<script type="text/javascript">
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
testRunner.waitUntilDone();
|
|
testRunner.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) {
|
|
isSuccessfullyParsed();
|
|
if (window.testRunner)
|
|
testRunner.notifyDone();
|
|
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);
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|