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

Side by Side Diff: tests/language/typed_message_test.dart

Issue 1133983002: Move isolate tests to lib/isolate. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix merge Created 5 years, 7 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program for testing isolate communication with
5 // typed objects.
6 // VMOptions=--checked
7
8 library TypedMessageTest;
9 import "dart:async";
10 import "package:expect/expect.dart";
11 import "package:async_helper/async_helper.dart";
12 import "dart:isolate";
13
14 void logMessages(SendPort replyTo) {
15 print("Starting log server.");
16 ReceivePort port = new ReceivePort();
17 replyTo.send(port.sendPort);
18 port.first.then((List<int> message) {
19 print("Log $message");
20 Expect.equals(5, message.length);
21 Expect.equals(0, message[0]);
22 Expect.equals(1, message[1]);
23 Expect.equals(2, message[2]);
24 Expect.equals(3, message[3]);
25 Expect.equals(4, message[4]);
26 port.close();
27 replyTo.send(1);
28 print("Stopping log server.");
29 });
30 }
31
32 main() {
33 asyncStart();
34 ReceivePort receivePort = new ReceivePort();
35 Future<Isolate> remote = Isolate.spawn(logMessages, receivePort.sendPort);
36 List<int> msg = new List<int>(5);
37 for (int i = 0; i < 5; i++) {
38 msg[i] = i;
39 }
40 StreamIterator iterator = new StreamIterator(receivePort);
41 iterator.moveNext().then((b) {
42 SendPort sendPort = iterator.current;
43 sendPort.send(msg);
44 return iterator.moveNext();
45 }).then((b) {
46 Expect.equals(1, iterator.current);
47 receivePort.close();
48 asyncEnd();
49 });
50 }
OLDNEW
« no previous file with comments | « tests/language/language_dart2js.status ('k') | tests/lib/async/deferred/deferred_in_isolate_lib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698