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

Side by Side Diff: tests/isolate/checked_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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import "dart:isolate"; 5 import "dart:isolate";
6 import "dart:async"; 6 import "dart:async";
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
9 9
10 void main([args, message]) { 10 void main([args, message]) {
11 if (message != null) return isolateMain(message); 11 if (message != null) return isolateMain(message);
12 12
13 bool isChecked = false; 13 bool isChecked = false;
14 assert((isChecked = true)); 14 assert((isChecked = true));
15 if (isChecked) return; // Skip this test in checked mode. 15 if (isChecked) return; // Skip this test in checked mode.
16 16
17 var responses = {}; 17 var responses = {};
18 var port = new RawReceivePort(); 18 var port = new RawReceivePort();
19 port.handler = (pair) { 19 port.handler = (pair) {
20 responses[pair[0]] = pair[1]; 20 responses[pair[0]] = pair[1];
21 if (responses.length == 3) { 21 if (responses.length == 3) {
22 port.close(); 22 port.close();
23 Expect.isTrue(responses[true], "true @ $isChecked"); 23 Expect.isTrue(responses[true], "true @ $isChecked");
24 Expect.isTrue(responses[false], "false @ $isChecked"); 24 Expect.isTrue(responses[false], "false @ $isChecked");
25 Expect.isTrue(responses[null], "null @ $isChecked"); 25 Expect.isTrue(responses[null], "null @ $isChecked");
26 } 26 }
27 }; 27 };
28 test(checked) { 28 test(checked) {
29 Isolate.spawnUri(Uri.parse("checked_test.dart"), [], 29 Isolate.spawnUri(
30 [checked, isChecked, port.sendPort], 30 Uri.parse("checked_test.dart"), [], [checked, isChecked, port.sendPort],
31 checked: checked); 31 checked: checked);
32 } 32 }
33
33 test(true); 34 test(true);
34 test(false); 35 test(false);
35 test(null); 36 test(null);
36 } 37 }
37 38
38
39 void isolateMain(args) { 39 void isolateMain(args) {
40 var checkedFlag = args[0]; 40 var checkedFlag = args[0];
41 var parentIsChecked = args[1]; 41 var parentIsChecked = args[1];
42 var responsePort = args[2]; 42 var responsePort = args[2];
43 bool isChecked = false; 43 bool isChecked = false;
44 assert((isChecked = true)); 44 assert((isChecked = true));
45 bool expected = checkedFlag; 45 bool expected = checkedFlag;
46 if (checkedFlag == null) expected = parentIsChecked; 46 if (checkedFlag == null) expected = parentIsChecked;
47 responsePort.send([checkedFlag, expected == isChecked]); 47 responsePort.send([checkedFlag, expected == isChecked]);
48 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698