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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 exit_at_spawn; 5 library exit_at_spawn;
6 6
7 import "dart:isolate"; 7 import "dart:isolate";
8 import "dart:async"; 8 import "dart:async";
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
11 11
12 // Isolate exiting immediately. 12 // Isolate exiting immediately.
13 isomain(args) {} 13 isomain(args) {}
14 14
15 // Isolate exiting after running microtasks. 15 // Isolate exiting after running microtasks.
16 isomain2(args) { 16 isomain2(args) {
17 scheduleMicrotask((){}); 17 scheduleMicrotask(() {});
18 } 18 }
19 19
20 // Isolate exiting after running timers. 20 // Isolate exiting after running timers.
21 isomain3(args) { 21 isomain3(args) {
22 new Timer(Duration.ZERO, (){}); 22 new Timer(Duration.ZERO, () {});
23 } 23 }
24 24
25 main(){ 25 main() {
26 asyncStart(); 26 asyncStart();
27 27
28 test(isomain); 28 test(isomain);
29 test(isomain2); 29 test(isomain2);
30 test(isomain3); 30 test(isomain3);
31 31
32 asyncEnd(); 32 asyncEnd();
33 } 33 }
34 34
35 void test(mainFunction) { 35 void test(mainFunction) {
36 asyncStart(); 36 asyncStart();
37 37
38 RawReceivePort exitPort = new RawReceivePort(); 38 RawReceivePort exitPort = new RawReceivePort();
39 exitPort.handler = (message) { 39 exitPort.handler = (message) {
40 Expect.equals(null, message); 40 Expect.equals(null, message);
41 exitPort.close(); 41 exitPort.close();
42 asyncEnd(); 42 asyncEnd();
43 }; 43 };
44 44
45 Isolate.spawn(mainFunction, 45 Isolate.spawn(mainFunction, null,
46 null, 46 // Setup handler as part of spawn.
47 // Setup handler as part of spawn. 47 errorsAreFatal: false,
48 errorsAreFatal: false, 48 onExit: exitPort.sendPort);
49 onExit: exitPort.sendPort);
50 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698