-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "checked" parameter to Isolate.spawnUri.
- Loading branch information
Showing
9 changed files
with
112 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import "dart:isolate"; | ||
import "dart:async"; | ||
import "package:expect/expect.dart"; | ||
import "package:async_helper/async_helper.dart"; | ||
|
||
void main([args, message]) { | ||
if (message != null) return isolateMain(message); | ||
|
||
bool isChecked = false; | ||
assert((isChecked = true)); | ||
if (isChecked) return; // Skip this test in checked mode. | ||
|
||
var responses = {}; | ||
var port = new RawReceivePort(); | ||
port.handler = (pair) { | ||
responses[pair[0]] = pair[1]; | ||
if (responses.length == 3) { | ||
port.close(); | ||
Expect.isTrue(responses[true], "true @ $isChecked"); | ||
Expect.isTrue(responses[false], "false @ $isChecked"); | ||
Expect.isTrue(responses[null], "null @ $isChecked"); | ||
} | ||
}; | ||
test(checked) { | ||
Isolate.spawnUri(Uri.parse("checked_test.dart"), [], | ||
[checked, isChecked, port.sendPort], | ||
checked: checked); | ||
} | ||
test(true); | ||
test(false); | ||
test(null); | ||
} | ||
|
||
|
||
void isolateMain(args) { | ||
var checkedFlag = args[0]; | ||
var parentIsChecked = args[1]; | ||
var responsePort = args[2]; | ||
bool isChecked = false; | ||
assert((isChecked = true)); | ||
bool expected = checkedFlag; | ||
if (checkedFlag == null) expected = parentIsChecked; | ||
responsePort.send([checkedFlag, expected == isChecked]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters