Chromium Code Reviews| OLD | NEW |
|---|---|
| (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]) { | |
|
kevmoo
2015/06/02 17:42:55
How will this be marked in the status file for dar
Lasse Reichstein Nielsen
2015/06/03 06:55:25
Yes, thanks for reminding me :)
| |
| 11 if (message != null) return isolateMain(message); | |
| 12 | |
| 13 bool isChecked = false; | |
| 14 assert((isChecked = true)); | |
| 15 if (isChecked) return; // Skip this test in checked mode. | |
|
kevmoo
2015/06/02 17:42:55
should this 'check' happen in the status file?
Lasse Reichstein Nielsen
2015/06/03 06:55:25
I'd prefer to not have it at all, but that require
| |
| 16 | |
| 17 var responses = {}; | |
| 18 var port = new RawReceivePort(); | |
| 19 port.handler = (pair) { | |
| 20 responses[pair[0]] = pair[1]; | |
| 21 if (responses.length == 3) { | |
| 22 port.close(); | |
| 23 Expect.isTrue(responses[true], "true @ $isChecked"); | |
| 24 Expect.isTrue(responses[false], "false @ $isChecked"); | |
| 25 Expect.isTrue(responses[null], "null @ $isChecked"); | |
| 26 } | |
| 27 }; | |
| 28 test(checked) { | |
| 29 Isolate.spawnUri(Uri.parse("checked_test.dart"), [], | |
| 30 [checked, isChecked, port.sendPort], | |
| 31 checked: checked) | |
| 32 .catchError(print); | |
| 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 } | |
| OLD | NEW |