Index: client/tests/client/dom/WindowOpenTest.dart |
diff --git a/client/tests/client/dom/WindowOpenTest.dart b/client/tests/client/dom/WindowOpenTest.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..302219ea1b2e1a389a74c1c89f84a0039f181d9d |
--- /dev/null |
+++ b/client/tests/client/dom/WindowOpenTest.dart |
@@ -0,0 +1,33 @@ |
+#library('WindowOpenTest'); |
+#import('../../../testing/unittest/unittest.dart'); |
+#import('dart:dom'); |
+ |
+main() { |
+ // FIXME: when JS DOM has proper layoutTestController support, should go away. |
+ window.setTimeout(() { |
+ evaluateJavaScript(code) { |
+ final scriptTag = document.createElement('script'); |
+ scriptTag.innerHTML = code; |
+ document.body.appendChild(scriptTag); |
+ } |
+ evaluateJavaScript('layoutTestController.setCanOpenWindows()'); |
+ }, 0); |
+ |
+ forLayoutTests(); |
+ asyncTest('TwoArgumentVersion', 1, () { |
+ Window win = window.open('../resources/pong.html', 'testWindow'); |
+ closeWindow(win); |
+ }); |
+ asyncTest('ThreeArgumentVersion', 1, () { |
+ Window win = window.open("resources/pong.html", "testWindow", "scrollbars=yes,width=75,height=100"); |
+ closeWindow(win); |
+ }); |
+} |
+ |
+closeWindow(win) { |
+ win.close(); |
+ doneHandler() { |
+ window.setTimeout(win.closed ? callbackDone : doneHandler, 1); |
+ } |
+ window.setTimeout(doneHandler, 1); |
+} |