Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / window-resize-and-move-arguments.html
blob1906d031591d942063a299be68d7b2bcc965bb20
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script language="JavaScript" type="text/javascript">
8 var resetWidth;
9 var resetHeight;
10 var resetX;
11 var resetY;
13 var width = 100;
14 var height = 200;
15 var x = 25;
16 var y = 50;
18 function reset()
20 window.moveTo(screen.availLeft + 100, screen.availTop + 100);
21 window.resizeTo(300, 200);
22 resetWidth = window.outerWidth;
23 resetHeight = window.outerHeight;
24 resetX = window.screenX;
25 resetY = window.screenY;
28 if (window.testRunner)
29 testRunner.dumpAsText();
31 reset();
33 description("This test makes sure that calling the window moving and resizing\
34 methods with less than 2 arguments treats the missing arguments as 0.");
36 // resizeTo /////////////////////////
37 debug('');
38 debug('window.resizeTo Tests');
39 debug('');
41 debug("Testing - resizeTo with 0 arguments");
42 shouldThrow('window.resizeTo()');
43 shouldBe('window.outerWidth', 'resetWidth');
44 shouldBe('window.outerHeight', 'resetHeight');
45 reset();
47 debug("Testing - resizeTo with 1 argument");
48 shouldThrow('window.resizeTo(width)');
49 shouldBe('window.outerWidth', 'resetWidth');
50 shouldBe('window.outerHeight', 'resetHeight');
51 reset();
53 debug("Testing - resizeTo with more than 2 arguments");
54 window.resizeTo(width, height, 200, "text");
55 shouldBe('window.outerWidth', 'width');
56 shouldBe('window.outerHeight', 'height');
57 reset();
59 // resizeBy /////////////////////////
60 debug('');
61 debug('window.resizeBy Tests');
62 debug('');
64 debug("Testing - resizeBy with 0 arguments");
65 shouldThrow('window.resizeBy()');
66 shouldBe('window.outerWidth', 'resetWidth');
67 shouldBe('window.outerHeight', 'resetHeight');
68 reset();
70 debug("Testing - resizeBy with 1 argument");
71 shouldThrow('window.resizeBy(x)');
72 shouldBe('window.outerWidth', 'resetWidth');
73 shouldBe('window.outerHeight', 'resetHeight');
74 reset();
76 debug("Testing - resizeBy with more than 2 arguments");
77 window.resizeBy(x, y, 200, "text");
78 shouldBe('window.outerWidth', 'resetWidth + x');
79 shouldBe('window.outerHeight', 'resetHeight + y');
80 reset();
83 // moveTo /////////////////////////
84 debug('');
85 debug('window.moveTo Tests');
86 debug('');
88 debug("Testing - moveTo with 0 arguments");
89 shouldThrow('window.moveTo()');
90 shouldBe('window.screenX', 'resetX');
91 shouldBe('window.screenY', 'resetY');
92 reset();
94 debug("Testing - moveTo with 1 argument");
95 shouldThrow('window.moveTo(x)');
96 shouldBe('window.screenX', 'resetX');
97 shouldBe('window.screenY', 'resetY');
98 reset();
100 debug("Testing - moveTo with more than 2 arguments");
101 window.moveTo(x, y, 200, "text");
102 shouldBe('window.screenX', 'Math.max(x, screen.availLeft)');
103 shouldBe('window.screenY', 'Math.max(y, screen.availTop)');
104 reset();
108 // moveBy /////////////////////////
109 debug('');
110 debug('window.moveBy Tests');
111 debug('');
113 debug("Testing - moveBy with 0 arguments");
114 shouldThrow('window.moveBy()');
115 shouldBe('window.screenX', 'resetX');
116 shouldBe('window.screenY', 'resetY');
117 reset();
119 debug("Testing - moveBy with 1 argument");
120 shouldThrow('window.moveBy(x)');
121 shouldBe('window.screenX', 'resetX');
122 shouldBe('window.screenY', 'resetY');
123 reset();
125 debug("Testing - moveBy with more than 2 arguments");
126 window.moveBy(x, y, 200, "text");
127 shouldBe('window.screenX', 'resetX + x');
128 shouldBe('window.screenY', 'resetY + y');
129 </script>
130 </body>
131 </html>