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

Side by Side Diff: tests/isolate/cross_isolate_message_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 // Dart test program for testing that isolates can communicate to isolates 5 // Dart test program for testing that isolates can communicate to isolates
6 // other than the main isolate. 6 // other than the main isolate.
7 7
8 library CrossIsolateMessageTest; 8 library CrossIsolateMessageTest;
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 22 matching lines...) Expand all
33 33
34 void crossIsolate2(SendPort toIsolate1) { 34 void crossIsolate2(SendPort toIsolate1) {
35 toIsolate1.send(["fromIsolate2", 42]); 35 toIsolate1.send(["fromIsolate2", 42]);
36 } 36 }
37 37
38 void main([args, port]) { 38 void main([args, port]) {
39 if (testRemote(main, port)) return; 39 if (testRemote(main, port)) return;
40 test("send message cross isolates ", () { 40 test("send message cross isolates ", () {
41 ReceivePort fromIsolate1 = new ReceivePort(); 41 ReceivePort fromIsolate1 = new ReceivePort();
42 Isolate.spawn(crossIsolate1, fromIsolate1.sendPort); 42 Isolate.spawn(crossIsolate1, fromIsolate1.sendPort);
43 var done = expectAsync0((){}); 43 var done = expectAsync((){});
44 fromIsolate1.listen((msg) { 44 fromIsolate1.listen((msg) {
45 switch (msg[0]) { 45 switch (msg[0]) {
46 case "ready1": 46 case "ready1":
47 SendPort toIsolate1 = msg[1]; 47 SendPort toIsolate1 = msg[1];
48 Isolate.spawn(crossIsolate2, toIsolate1); 48 Isolate.spawn(crossIsolate2, toIsolate1);
49 break; 49 break;
50 case "fromIsolate1": 50 case "fromIsolate1":
51 expect(msg[1], 100); 51 expect(msg[1], 100);
52 fromIsolate1.close(); 52 fromIsolate1.close();
53 break; 53 break;
54 default: 54 default:
55 fail("unreachable! Tag: ${msg[0]}"); 55 fail("unreachable! Tag: ${msg[0]}");
56 } 56 }
57 }, onDone: done); 57 }, onDone: done);
58 }); 58 });
59 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698