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

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

Issue 218273002: Upgrading tests with unittest deprecations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 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 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import "remote_unittest_helper.dart"; 9 import "remote_unittest_helper.dart";
10 10
11 void entry(initPort) { 11 void entry(initPort) {
12 ReceivePort port = new ReceivePort(); 12 ReceivePort port = new ReceivePort();
13 initPort.send(port.sendPort); 13 initPort.send(port.sendPort);
14 port.listen((pair) { 14 port.listen((pair) {
15 var message = pair[0]; 15 var message = pair[0];
16 SendPort replyTo = pair[1]; 16 SendPort replyTo = pair[1];
17 replyTo.send(message + 87); 17 replyTo.send(message + 87);
18 port.close(); 18 port.close();
19 }); 19 });
20 } 20 }
21 21
22 void main([args, port]) { 22 void main([args, port]) {
23 if (testRemote(main, port)) return; 23 if (testRemote(main, port)) return;
24 test("send", () { 24 test("send", () {
25 ReceivePort init = new ReceivePort(); 25 ReceivePort init = new ReceivePort();
26 Isolate.spawn(entry, init.sendPort); 26 Isolate.spawn(entry, init.sendPort);
27 init.first.then(expectAsync1((port) { 27 init.first.then(expectAsync((port) {
28 ReceivePort reply = new ReceivePort(); 28 ReceivePort reply = new ReceivePort();
29 port.send([99, reply.sendPort]); 29 port.send([99, reply.sendPort]);
30 reply.listen(expectAsync1((message) { 30 reply.listen(expectAsync((message) {
31 expect(message, 99 + 87); 31 expect(message, 99 + 87);
32 reply.close(); 32 reply.close();
33 })); 33 }));
34 })); 34 }));
35 }); 35 });
36 } 36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698