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); |
}); |
} |