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

Side by Side Diff: tests/isolate/src/APIv2_unresolvedPortsStandaloneTest.dart

Issue 9422019: isolates refactor: this change introduces 'dart:isolate' as a library. This is a (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 years, 9 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 // spawns multiple isolates and sends unresolved ports between them. 5 // spawns multiple isolates and sends unresolved ports between them.
6 #library('unresolved_ports'); 6 #library('unresolved_ports');
7 #import('dart:isolate');
7 8
8 // This test does the following: 9 // This test does the following:
9 // - main spawns two isolates: 'tim' and 'beth' 10 // - main spawns two isolates: 'tim' and 'beth'
10 // - 'tim' spawns an isolate: 'bob' 11 // - 'tim' spawns an isolate: 'bob'
11 // - main starts a message chain: 12 // - main starts a message chain:
12 // main -> beth -> tim -> bob -> main 13 // main -> beth -> tim -> bob -> main
13 // by giving 'beth' a send-port to 'tim'. 14 // by giving 'beth' a send-port to 'tim'.
14 15
15 bethIsolate(ReceivePort port) { 16 bethIsolate(ReceivePort port) {
16 port.receive((msg, reply) => msg[1].send( 17 port.receive((msg, reply) => msg[1].send(
(...skipping 23 matching lines...) Expand all
40 41
41 Isolate2 tim = new Isolate2.fromCode(timIsolate); 42 Isolate2 tim = new Isolate2.fromCode(timIsolate);
42 Isolate2 beth = new Isolate2.fromCode(bethIsolate); 43 Isolate2 beth = new Isolate2.fromCode(bethIsolate);
43 44
44 beth.sendPort.send( 45 beth.sendPort.send(
45 // because tim is created asynchronously, here we are sending an 46 // because tim is created asynchronously, here we are sending an
46 // unresolved port: 47 // unresolved port:
47 ["main says: Beth, find out if Tim is coming.", tim.sendPort], 48 ["main says: Beth, find out if Tim is coming.", tim.sendPort],
48 port.toSendPort()); 49 port.toSendPort());
49 } 50 }
OLDNEW
« no previous file with comments | « tests/isolate/src/APIv2_unresolvedPortsStandaloneNegativeTest.dart ('k') | tests/isolate/src/ConstructorTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698