OLD | NEW |
1 #library('WindowOpenTest'); | 1 #library('WindowOpenTest'); |
2 #import('../../../../lib/unittest/unittest.dart'); | 2 #import('../../lib/unittest/unittest.dart'); |
3 #import('../../../../lib/unittest/dom_config.dart'); | 3 #import('../../lib/unittest/dom_config.dart'); |
4 #import('dart:dom'); | 4 #import('dart:dom'); |
5 | 5 |
6 main() { | 6 main() { |
7 evaluateJavaScript(code) { | 7 evaluateJavaScript(code) { |
8 final scriptTag = document.createElement('script'); | 8 final scriptTag = document.createElement('script'); |
9 scriptTag.innerHTML = code; | 9 scriptTag.innerHTML = code; |
10 document.body.appendChild(scriptTag); | 10 document.body.appendChild(scriptTag); |
11 } | 11 } |
12 evaluateJavaScript('layoutTestController.setCanOpenWindows()'); | 12 evaluateJavaScript('layoutTestController.setCanOpenWindows()'); |
13 | 13 |
14 useDomConfiguration(); | 14 useDomConfiguration(); |
15 asyncTest('TwoArgumentVersion', 1, () { | 15 asyncTest('TwoArgumentVersion', 1, () { |
16 Window win = window.open('../resources/pong.html', 'testWindow'); | 16 Window win = window.open('../resources/pong.html', 'testWindow'); |
17 closeWindow(win); | 17 closeWindow(win); |
18 }); | 18 }); |
19 asyncTest('ThreeArgumentVersion', 1, () { | 19 asyncTest('ThreeArgumentVersion', 1, () { |
20 Window win = window.open("resources/pong.html", "testWindow", "scrollbars=ye
s,width=75,height=100"); | 20 Window win = window.open("resources/pong.html", "testWindow", "scrollbars=ye
s,width=75,height=100"); |
21 closeWindow(win); | 21 closeWindow(win); |
22 }); | 22 }); |
23 } | 23 } |
24 | 24 |
25 closeWindow(win) { | 25 closeWindow(win) { |
26 win.close(); | 26 win.close(); |
27 doneHandler() { | 27 doneHandler() { |
28 window.setTimeout(win.closed ? callbackDone : doneHandler, 1); | 28 window.setTimeout(win.closed ? callbackDone : doneHandler, 1); |
29 } | 29 } |
30 window.setTimeout(doneHandler, 1); | 30 window.setTimeout(doneHandler, 1); |
31 } | 31 } |
OLD | NEW |