Chromium Code Reviews| Index: tests/standalone/package/package_isolate_test.dart |
| diff --git a/tests/standalone/package/package_isolate_test.dart b/tests/standalone/package/package_isolate_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d44d11471d94f41d1f7f181e021016a4614e2831 |
| --- /dev/null |
| +++ b/tests/standalone/package/package_isolate_test.dart |
| @@ -0,0 +1,43 @@ |
| +// 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 package_isolate_test; |
| + |
| +import 'package:shared.dart'; |
|
siva
2012/10/17 17:26:23
I think you should import this with a prefix and u
justinfagnani
2012/10/17 18:11:56
Done.
|
| +import 'dart:isolate'; |
| +import '../../../pkg/unittest/unittest.dart'; |
| + |
| +expectResponse() { |
| + port.receive(expectAsync2((msg, r) { |
| + expect('success', msg); |
|
siva
2012/10/17 17:26:23
Maybe also have:
expect('success', <prefix>.output
justinfagnani
2012/10/17 18:11:56
It should be a different instance of the output va
|
| + port.close(); |
| + })); |
| +} |
| + |
| +void main() { |
| + test("package in spawnFunction()", () { |
| + expectResponse(); |
|
siva
2012/10/17 17:26:23
<prefix>.output = 'junk';
justinfagnani
2012/10/17 18:11:56
Done.
|
| + var sendPort = spawnFunction(isolate_main); |
| + sendPort.send("sendPort", port.toSendPort()); |
| + }); |
| + |
| + test("package in spawnUri() of sibling file", () { |
|
siva
2012/10/17 17:26:23
<prefix>.output = 'junk';
justinfagnani
2012/10/17 18:11:56
Done.
|
| + expectResponse(); |
| + var sendPort = spawnUri('sibling_isolate.dart'); |
| + sendPort.send('sendPort', port.toSendPort()); |
| + }); |
| + |
| + test("package in spawnUri() of file in folder", () { |
| + expectResponse(); |
| + var sendPort = spawnUri('test_folder/folder_isolate.dart'); |
| + sendPort.send('sendPort', port.toSendPort()); |
| + }); |
| +} |
| + |
| +void isolate_main() { |
| + output = 'success'; |
| + port.receive((msg, replyTo) { |
| + replyTo.send(output); |
| + }); |
| +} |