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

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: 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
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..88f54bf32e31b90d16e96905e076c53bf47519d4
--- /dev/null
+++ b/tests/html/js_interop_1_test.dart
@@ -0,0 +1,26 @@
+#library('JsInterop1Test');
kasperl 2012/07/04 05:13:00 Add copyright notice.
vsm 2012/07/04 07:43:09 Done.
+#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) {
kasperl 2012/07/04 05:13:00 Too much indentation: Use 2 spaces here.
vsm 2012/07/04 07:43:09 Done.
+ Expect.equals('hello', e.data);
kasperl 2012/07/04 05:13:00 Too much indentation. Use 2 spaces here.
vsm 2012/07/04 07:43:09 Done.
+ window.on.message.remove(callback);
+ });
kasperl 2012/07/04 05:13:00 Don't indent this.
vsm 2012/07/04 07:43:09 Done.
+ window.on.message.add(callback);
+ injectSource("window.postMessage('hello', '*');");
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698