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

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

Issue 70103014: Make isolate tests work on drt (and hopefully dartium). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Close the receivePort if we fail spawning. Created 7 years 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 library MandelIsolateTest; 5 library MandelIsolateTest;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 import 'dart:math'; 8 import 'dart:math';
9 import '../../pkg/unittest/lib/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import "remote_unittest_helper.dart";
10 11
11 const TERMINATION_MESSAGE = -1; 12 const TERMINATION_MESSAGE = -1;
12 const N = 100; 13 const N = 100;
13 const ISOLATES = 20; 14 const ISOLATES = 20;
14 15
15 main() { 16 void main([args, port]) {
17 if (testRemote(main, port)) return;
16 // Test is really slow in debug builds of the VM. 18 // Test is really slow in debug builds of the VM.
17 SimpleConfiguration configuration = unittestConfiguration; 19 var configuration = unittestConfiguration;
18 configuration.timeout = const Duration(seconds: 480); 20 configuration.timeout = const Duration(seconds: 480);
19 test("Render Mandelbrot in parallel", () { 21 test("Render Mandelbrot in parallel", () {
20 final state = new MandelbrotState(); 22 final state = new MandelbrotState();
21 state._validated.future.then(expectAsync1((result) { 23 state._validated.future.then(expectAsync1((result) {
22 expect(result, isTrue); 24 expect(result, isTrue);
23 })); 25 }));
24 for (int i = 0; i < min(ISOLATES, N); i++) state.startClient(i); 26 for (int i = 0; i < min(ISOLATES, N); i++) state.startClient(i);
25 }); 27 });
26 } 28 }
27 29
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if (message != TERMINATION_MESSAGE) { 152 if (message != TERMINATION_MESSAGE) {
151 int line = message[0]; 153 int line = message[0];
152 SendPort replyTo = message[1]; 154 SendPort replyTo = message[1];
153 replyTo.send(processLine(line)); 155 replyTo.send(processLine(line));
154 } else { 156 } else {
155 port.close(); 157 port.close();
156 } 158 }
157 }); 159 });
158 replyPort.send(port.sendPort); 160 replyPort.send(port.sendPort);
159 } 161 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698