Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / new-window-opener.html
bloba83bb14fa62a8ff568c13fb458144f8f8c96f6db
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <title>New Window Opener Test</title>
5 <script src="../../../resources/js-test.js"></script>
6 </head>
8 <body>
10 <script type="text/javascript">
11 if (window.testRunner) {
12 testRunner.dumpAsText();
13 testRunner.waitUntilDone();
14 testRunner.setCanOpenWindows();
18 description(
19 'This tests that the different arguments given to a new window are honored.<br/>\
20 Take note that menubar is special and always on in Mac but not in Win.'
23 var args = [ "scrollbars=yes,width=75,height=100"
24 , "scrollbars=no,width=75,height=100"
25 , "scrollbars=1,width=75,height=100"
26 , "scrollbars=0,width=75,height=100"
27 , "toolbar=yes,width=75,height=100"
28 , "toolbar=no,width=75,height=100"
29 , "toolbar=1,width=75,height=100"
30 , "toolbar=0,width=75,height=100"
31 , "status=yes,width=75,height=100"
32 , "status=no,width=75,height=100"
33 , "status=1,width=75,height=100"
34 , "status=0,width=75,height=100"
35 , "menubar=yes,width=75,height=100"
36 , "menubar=no,width=75,height=100"
37 , "menubar=1,width=75,height=100"
38 , "menubar=0,width=75,height=100"
39 , "location=yes,width=75,height=100"
40 , "location=no,width=75,height=100"
41 , "location=1,width=75,height=100"
42 , "location=0,width=75,height=100"
45 var actual = [ "newWin.scrollbars.visible", "newWin.scrollbars.visible", "newWin.scrollbars.visible", "newWin.scrollbars.visible"
46 , "newWin.toolbar.visible", "newWin.toolbar.visible", "newWin.toolbar.visible", "newWin.toolbar.visible"
47 , "newWin.statusbar.visible", "newWin.statusbar.visible", "newWin.statusbar.visible", "newWin.statusbar.visible"
48 , "newWin.menubar.visible", "newWin.menubar.visible", "newWin.menubar.visible", "newWin.menubar.visible"
49 , "newWin.locationbar.visible", "newWin.locationbar.visible", "newWin.locationbar.visible", "newWin.locationbar.visible"
52 var expected = [ "true", "false", "true", "false"
53 , "true", "false", "true", "false"
54 , "true", "false", "true", "false"
55 , "true", "isMenubarAlwaysExpected", "true", "isMenubarAlwaysExpected"
56 , "true", "false", "true", "false"
59 // Since Mac always shows the menu bar we need to special case it, but in
60 // a way that does not require platform specific results.
61 var isMacOSX = navigator.userAgent.indexOf("Mac OS X");
62 var isMenubarAlwaysExpected;
63 if (isMacOSX != -1)
64 isMenubarAlwaysExpected = true;
65 else
66 isMenubarAlwaysExpected = false;
68 var testNum = 0;
69 var lastTest = args.length;
70 var newWin;
72 nextTest();
73 function nextTest() {
74 if (testNum == lastTest) {
75 isSuccessfullyParsed();
76 if (window.testRunner)
77 testRunner.notifyDone();
78 return;
79 } else if (testNum == 0) {
80 debug("");
81 debug("Scrollbar");
82 } else if (testNum == 4) {
83 debug("");
84 debug("Toolbar");
85 } else if (testNum == 8) {
86 debug("");
87 debug("Statusbar");
88 } else if (testNum == 12) {
89 debug("");
90 debug("Menubar");
91 } else if (testNum == 16) {
92 debug("");
93 debug("Locationbar");
96 //get the next test and run it.
97 newWin = window.open("../resources/abe.png", "testWindow", args[testNum] );
98 shouldBe(actual[testNum], expected[testNum]);
99 ++testNum;
100 closeAndRunNextTest(newWin);
103 function closeAndRunNextTest(winToClose) {
104 winToClose.close();
105 setTimeout(doneHandler, 1);
107 function doneHandler() {
108 if (winToClose.closed) {
109 setTimeout(nextTest, 1);
110 return;
112 setTimeout(doneHandler, 1);
116 </script>
117 </body>
118 </html>