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

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

Issue 10837070: Remove old isolate API and update all code in the repository to use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix namespace comment. Created 8 years, 4 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) 2011, 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("SpawnTest"); 5 #library("SpawnTest");
Siggi Cherem (dart-lang) 2012/08/02 16:43:35 this test might be redundant with v2_spawn_functio
Mads Ager (google) 2012/08/03 05:51:35 I have removed this test. It is redundant with the
6 #import("dart:isolate"); 6 #import("dart:isolate");
7 #import('../../lib/unittest/unittest.dart'); 7 #import('../../lib/unittest/unittest.dart');
8 8
9 main() { 9 main() {
10 test("spawn a new isolate", () { 10 test("spawn a new isolate", () {
11 SpawnedIsolate isolate = new SpawnedIsolate(); 11 SendPort port = spawnFunction(entry);
12 isolate.spawn().then(expectAsync1((SendPort port) { 12 port.call(42).then(expectAsync1((message) {
13 port.call(42).then(expectAsync1((message) { 13 Expect.equals(42, message);
14 Expect.equals(42, message);
15 }));
16 })); 14 }));
17 }); 15 });
18 } 16 }
19 17
20 class SpawnedIsolate extends Isolate { 18 void entry() {
21 19 port.receive((message, SendPort replyTo) {
22 SpawnedIsolate() : super() { } 20 Expect.equals(42, message);
23 21 replyTo.send(42, null);
24 void main() { 22 port.close();
25 this.port.receive((message, SendPort replyTo) { 23 });
26 Expect.equals(42, message);
27 replyTo.send(42, null);
28 this.port.close();
29 });
30 }
31
32 } 24 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698