Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1415)

Unified Diff: tests/html/js_interop_1_test.dart

Issue 10696092: Initial tests for JS interop (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/html.status ('k') | tests/html/js_interop_2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/js_interop_1_test.dart
diff --git a/tests/html/js_interop_1_test.dart b/tests/html/js_interop_1_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5af581efbd662ec82abe902d62ed00c0d6e47ef8
--- /dev/null
+++ b/tests/html/js_interop_1_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file
+
+#library('JsInterop1Test');
+#import('../../lib/unittest/unittest.dart');
+#import('../../lib/unittest/html_config.dart');
+#import('dart:html');
+#import('dart:json');
+
+injectSource(code) {
+ final script = new ScriptElement();
+ script.type = 'text/javascript';
+ script.innerHTML = code;
+ document.body.nodes.add(script);
+}
+
+main() {
+ useHtmlConfiguration();
+ var callback;
+
+ test('jsPostMessage', () {
+ callback = expectAsync1((e) {
+ Expect.equals('hello', e.data);
+ window.on.message.remove(callback);
+ });
+ window.on.message.add(callback);
+ injectSource("window.postMessage('hello', '*');");
+ });
+}
« no previous file with comments | « tests/html/html.status ('k') | tests/html/js_interop_2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698