- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / window.close.html
1 <html>
2 <head>
3   <title>initial title</title>
4   <script>
5     var popup, popup2, popup3, popup4;
6
7     // window.open, window.close should be synchronous
8     function test1() {
9       popup = window.open('title1.html', 'name');
10       popup.close();
11
12       popup = window.open('title2.html', 'name', 'width=200,height=200');
13       popup.close();
14     }
15
16     // Try opening/closing a few windows.
17     function test2() {
18       openPopups();
19       closePopups();
20     }
21
22     function test3() {
23       openPopups();
24       setTimeout(closePopups, 0);
25       setTimeout(test4, 1);
26     }
27
28     function test4() {
29       openPopups();
30       setTimeout(closePopupsAndDone, 250);
31     }
32
33     function openPopups() {
34       popup = window.open('title1.html', 'name');
35       popup2 = window.open('title1.html', 'name2');
36       popup3 = window.open('title1.html', 'name3');
37       popup4 = window.open('title1.html', 'name4');
38     }
39
40     function closePopups() {
41       popup.close();
42       popup2.close();
43       popup3.close();
44       popup4.close();
45     }
46
47     function closePopupsAndDone() {
48       closePopups();
49       document.location = 'title2.html'
50     }
51
52     function startTheTest() {
53       test1();
54       test2();
55       test3();
56     }
57   </script>
58 </head>
59 <body onload="startTheTest()">
60 </body>
61 </html>