| OLD | NEW |
| 1 library WindowOpenTest; | 1 library WindowOpenTest; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_config.dart'; | 3 import '../../pkg/unittest/lib/html_config.dart'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 main() { | 7 main() { |
| 8 useHtmlConfiguration(); | 8 useHtmlConfiguration(); |
| 9 evaluateJavaScript(code) { | 9 evaluateJavaScript(code) { |
| 10 final scriptTag = new Element.tag('script'); | 10 final scriptTag = new Element.tag('script'); |
| 11 scriptTag.innerHtml = code; | 11 scriptTag.innerHtml = code; |
| 12 document.body.nodes.add(scriptTag); | 12 document.body.append(scriptTag); |
| 13 } | 13 } |
| 14 evaluateJavaScript('(testRunner || layoutTestController).setCanOpenWindows()')
; | 14 evaluateJavaScript('(testRunner || layoutTestController).setCanOpenWindows()')
; |
| 15 | 15 |
| 16 test('TwoArgumentVersion', () { | 16 test('TwoArgumentVersion', () { |
| 17 Window win = window.open('../resources/pong.html', 'testWindow'); | 17 Window win = window.open('../resources/pong.html', 'testWindow'); |
| 18 closeWindow(win); | 18 closeWindow(win); |
| 19 }); | 19 }); |
| 20 test('ThreeArgumentVersion', () { | 20 test('ThreeArgumentVersion', () { |
| 21 Window win = window.open("resources/pong.html", "testWindow", "scrollbars=ye
s,width=75,height=100"); | 21 Window win = window.open("resources/pong.html", "testWindow", "scrollbars=ye
s,width=75,height=100"); |
| 22 closeWindow(win); | 22 closeWindow(win); |
| 23 }); | 23 }); |
| 24 } | 24 } |
| 25 | 25 |
| 26 closeWindow(win) { | 26 closeWindow(win) { |
| 27 win.close(); | 27 win.close(); |
| 28 doneHandler() { | 28 doneHandler() { |
| 29 if (!win.closed) { | 29 if (!win.closed) { |
| 30 new Timer(const Duration(milliseconds: 1), expectAsync0(doneHandler)); | 30 new Timer(const Duration(milliseconds: 1), expectAsync0(doneHandler)); |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 new Timer(const Duration(milliseconds: 1), expectAsync0(doneHandler)); | 33 new Timer(const Duration(milliseconds: 1), expectAsync0(doneHandler)); |
| 34 } | 34 } |
| OLD | NEW |