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

Unified 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: Skip test for everything but VM for now. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/isolate/isolate.dart ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/checked_test.dart
diff --git a/tests/isolate/checked_test.dart b/tests/isolate/checked_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..87f6a036ddc1a854216dcdc6be36d3f1aa1922c8
--- /dev/null
+++ b/tests/isolate/checked_test.dart
@@ -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]);
+}
« no previous file with comments | « sdk/lib/isolate/isolate.dart ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698