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

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

Issue 1154673004: Add "checked" parameter to Isolate.spawnUri. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add test. Created 5 years, 6 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
« sdk/lib/isolate/isolate.dart ('K') | « sdk/lib/isolate/isolate.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "dart:isolate";
6 import "dart:async";
7 import "package:expect/expect.dart";
8 import "package:async_helper/async_helper.dart";
9
10 void main([args, message]) {
11 bool isChecked = false;
12 assert((isChecked = true));
13
14 if (isChecked) return; // Skip this test in checked mode.
15
16 if (message != null) return isolateMain(message);
17
18 var responses = {};
19 var port = new RawReceivePort();
20 port.handler = (pair) {
21 responses[pair[0]] = pair[1];
22 if (responses.length == 3) {
23 port.close();
24 Expect.isTrue(responses[true], "true @ $isChecked");
25 Expect.isTrue(responses[false], "false @ $isChecked");
26 Expect.isTrue(responses[null], "null @ $isChecked");
27 }
28 };
29 test(checked) {
30 Isolate.spawnUri(Uri.parse("checked_test.dart"), [],
31 [checked, isChecked, port.sendPort],
32 checked: checked);
33 }
34 test(true);
35 test(false);
36 test(null);
37 }
38
39
40 void isolateMain(args) {
41 var checkedFlag = args[0];
42 var parentIsChecked = args[1];
43 var responsePort = args[2];
44 bool isChecked = false;
45 assert((isChecked = true));
46 bool expected = checkedFlag;
47 if (checkedFlag == null) expected = parentIsChecked;
48 responsePort.send([checkedFlag, expected == isChecked]);
49 }
OLDNEW
« sdk/lib/isolate/isolate.dart ('K') | « sdk/lib/isolate/isolate.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698