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

Unified Diff: tests/html/js_interop_func_passing_test.dart

Issue 10690142: Move function serialization to sync ports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « lib/isolate/serialization.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/js_interop_func_passing_test.dart
diff --git a/tests/html/js_interop_2_test.dart b/tests/html/js_interop_func_passing_test.dart
similarity index 77%
copy from tests/html/js_interop_2_test.dart
copy to tests/html/js_interop_func_passing_test.dart
index 87e489eef5dcd04cbbae922c58a765559bdb4bcf..d65a307282bedefcc1b7231d74d7051debbd2999 100644
--- a/tests/html/js_interop_2_test.dart
+++ b/tests/html/js_interop_func_passing_test.dart
@@ -2,7 +2,7 @@
// 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('JsInterop2Test');
+#library('JsInteropFuncPassingTest');
#import('../../lib/unittest/unittest.dart');
#import('../../lib/unittest/html_config.dart');
#import('dart:html');
@@ -16,27 +16,24 @@ injectSource(code) {
}
var isolateTest = """
- function test(data) {
- if (data == 'sent')
- return 'received';
- }
-
var port = new ReceivePortSync();
- port.receive(test);
+ port.receive(function (f) {
+ return f('fromJS');
+ });
window.registerPort('test', port.toSendPort());
""";
main() {
useHtmlConfiguration();
- test('dart-to-js-ports', () {
+ test('dart-to-js-function', () {
injectSource(isolateTest);
SendPortSync port = window.lookupPort('test');
- var result = port.callSync('sent');
+ var result = port.callSync((msg) {
+ Expect.equals('fromJS', msg);
+ return 'received';
+ });
Expect.equals('received', result);
-
- result = port.callSync('ignore');
- Expect.isNull(result);
});
}
« no previous file with comments | « lib/isolate/serialization.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698