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

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

Issue 10226008: Revert "unittest step 3 and 4: remove TestFramework.dart, make test.dart use" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « tests/isolate/src/MintMakerTest.dart ('k') | tests/isolate/src/MixedTest.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 heavy and light isolates can be mixed. 5 // Dart test program for testing that heavy and light isolates can be mixed.
6 6
7 #library('Mixed2Test'); 7 #library('Mixed2Test');
8 #import("dart:isolate"); 8 #import("dart:isolate");
9 #import('../../../lib/unittest/unittest.dart'); 9 #import('TestFramework.dart');
10 10
11 // We want to send a message from the main-isolate to a chain of different 11 // We want to send a message from the main-isolate to a chain of different
12 // isolates and then get a reply back. 12 // isolates and then get a reply back.
13 // In the following description heavy2 is not used, because it is shut down 13 // In the following description heavy2 is not used, because it is shut down
14 // just after heaving created heavy2.light1,2 and light3. 14 // just after heaving created heavy2.light1,2 and light3.
15 // main-> 15 // main->
16 // heavy1->heavy1.light1->heavy1.light2->heavy1.light3-> 16 // heavy1->heavy1.light1->heavy1.light2->heavy1.light3->
17 // heavy2.light1->heavy2.light2->heavy2.light3-> 17 // heavy2.light1->heavy2.light2->heavy2.light3->
18 // heavy3->heavy3.pong 18 // heavy3->heavy3.pong
19 19
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 Future<SendPort> pong = new LightPong().spawn(); 100 Future<SendPort> pong = new LightPong().spawn();
101 this.port.receive((msg, replyTo) { 101 this.port.receive((msg, replyTo) {
102 pong.then((SendPort pongPort) { 102 pong.then((SendPort pongPort) {
103 pongPort.send(msg + 30, replyTo); 103 pongPort.send(msg + 30, replyTo);
104 this.port.close(); 104 this.port.close();
105 }); 105 });
106 }); 106 });
107 } 107 }
108 } 108 }
109 109
110 void test(TestExpectation expect) {
111 Future<SendPort> heavy1 = expect.completes(new HeavyIsolate1().spawn());
112 Future<SendPort> heavy2 = expect.completes(new HeavyIsolate2().spawn());
113 Future<SendPort> heavy3 = expect.completes(new HeavyIsolate3().spawn());
110 114
111 main() { 115 heavy2.then(expect.runs1((SendPort heavy2Port) {
112 test("heavy and light isolates can be mixed", () { 116 heavy3.then(expect.runs1((SendPort heavy3Port) {
113 Future<SendPort> heavy1 = new HeavyIsolate1().spawn(); 117 heavy2Port.call(heavy3Port).then(expect.runs1((h2l1Port) {
114 Future<SendPort> heavy2 = new HeavyIsolate2().spawn(); 118 heavy1.then(expect.runs1((SendPort heavy1Port) {
115 Future<SendPort> heavy3 = new HeavyIsolate3().spawn(); 119 heavy1Port.send(h2l1Port, null);
116 120 // ---------------
117 heavy2.then(expectAsync1((SendPort heavy2Port) { 121 // Setup complete.
118 heavy3.then(expectAsync1((SendPort heavy3Port) { 122 // Start the chain-message.
119 heavy2Port.call(heavy3Port).then(expectAsync1((h2l1Port) { 123 heavy1Port.call(1).then(expect.runs1((result) {
120 heavy1.then(expectAsync1((SendPort heavy1Port) { 124 Expect.equals(6531, result);
121 heavy1Port.send(h2l1Port, null); 125 expect.succeeded();
122 // ---------------
123 // Setup complete.
124 // Start the chain-message.
125 heavy1Port.call(1).then(expectAsync1((result) {
126 Expect.equals(6531, result);
127 }));
128 })); 126 }));
129 })); 127 }));
130 })); 128 }));
131 })); 129 }));
132 }); 130 }));
133 } 131 }
132
133 main() {
134 runTests([test]);
135 }
OLDNEW
« no previous file with comments | « tests/isolate/src/MintMakerTest.dart ('k') | tests/isolate/src/MixedTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698