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

Side by Side Diff: tests/isolate/request_reply_test.dart

Issue 70103014: Make isolate tests work on drt (and hopefully dartium). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Retain isolate_stress_test in status file Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library RequestReplyTest; 5 library RequestReplyTest;
6 6
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 import '../../pkg/unittest/lib/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import "remote_unittest_helper.dart";
9 10
10 void entry(initPort) { 11 void entry(initPort) {
11 ReceivePort port = new ReceivePort(); 12 ReceivePort port = new ReceivePort();
12 initPort.send(port.sendPort); 13 initPort.send(port.sendPort);
13 port.listen((pair) { 14 port.listen((pair) {
14 var message = pair[0]; 15 var message = pair[0];
15 SendPort replyTo = pair[1]; 16 SendPort replyTo = pair[1];
16 replyTo.send(message + 87); 17 replyTo.send(message + 87);
17 port.close(); 18 port.close();
18 }); 19 });
19 } 20 }
20 21
21 void main() { 22 void main([args, port]) {
23 if (testRemote(main, port)) return;
22 test("send", () { 24 test("send", () {
23 ReceivePort init = new ReceivePort(); 25 ReceivePort init = new ReceivePort();
24 Isolate.spawn(entry, init.sendPort); 26 Isolate.spawn(entry, init.sendPort);
25 init.first.then(expectAsync1((port) { 27 init.first.then(expectAsync1((port) {
26 ReceivePort reply = new ReceivePort(); 28 ReceivePort reply = new ReceivePort();
27 port.send([99, reply.sendPort]); 29 port.send([99, reply.sendPort]);
28 reply.listen(expectAsync1((message) { 30 reply.listen(expectAsync1((message) {
29 expect(message, 99 + 87); 31 expect(message, 99 + 87);
30 reply.close(); 32 reply.close();
31 })); 33 }));
32 })); 34 }));
33 }); 35 });
34 } 36 }
OLDNEW
« no previous file with comments | « tests/isolate/remote_unittest_helper.dart ('k') | tests/isolate/spawn_function_custom_class_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698