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

Unified Diff: tests/isolate/src/PromiseBasedTest.dart

Issue 9401030: remove promise from corelib (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 years, 10 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 | « tests/isolate/src/MintMakerPromiseTest.dart ('k') | tests/isolate/src/TestFramework.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/src/PromiseBasedTest.dart
diff --git a/tests/isolate/src/PromiseBasedTest.dart b/tests/isolate/src/PromiseBasedTest.dart
deleted file mode 100644
index 2be2d7b2a5a97ae981a5c5b4a01ef1ef58f9f1d9..0000000000000000000000000000000000000000
--- a/tests/isolate/src/PromiseBasedTest.dart
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2011, 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.
-
-#library("PromiseBasedTest");
-#import("TestFramework.dart");
-
-class TestIsolate extends Isolate {
-
- TestIsolate() : super();
-
- void main() {
- int seed = 0;
- this.port.receive((var message, SendPort replyTo) {
- //print("Got ${message[0]}");
- if (seed == 0) {
- seed = message[0];
- } else {
- Promise<int> response = new Promise<int>();
- var proxy = new Proxy.forPort(replyTo);
- //print("send to proxy");
- proxy.send([response]);
- //print("sent");
- response.complete(seed + message[0]);
- this.port.close();
- }
- });
- }
-
-}
-
-void test(TestExpectation expect) {
- Proxy proxy = new Proxy.forIsolate(new TestIsolate());
- proxy.send([42]); // Seed the isolate.
- Promise<int> result = new PromiseProxy<int>(proxy.call([87]));
- Completer completer = new Completer();
- expect.completes(result).then((int value) {
- //print("expect 1: $value");
- Expect.equals(42 + 87, value);
- completer.complete(99);
- });
- expect.completes(completer.future).then((int value) {
- //print("expect 2: $value");
- Expect.equals(99, value);
- expect.succeeded();
- });
-}
-
-void expandedTest(TestExpectation expect) {
- Proxy proxy = new Proxy.forIsolate(new TestIsolate());
- proxy.send([42]); // Seed the isolate.
- Promise<SendPort> sendCompleter = proxy.call([87]);
- Promise<int> result = new Promise<int>();
- ReceivePort receivePort = new ReceivePort.singleShot();
- receivePort.receive((var msg, SendPort _) {
- //print("test completer");
- result.complete(msg[0]);
- });
- sendCompleter.addCompleteHandler((SendPort port) {
- //print("test send");
- port.send([receivePort.toSendPort()], null);
- });
- Completer completer = new Completer();
- expect.completes(result).then((int value) {
- //print("expect 1: $value");
- Expect.equals(42 + 87, value);
- completer.complete(99);
- });
- expect.completes(completer.future).then((int value) {
- //print("expect 2: $value");
- Expect.equals(99, value);
- expect.succeeded();
- });
-}
-
-void main() {
- runTests([test, expandedTest]);
-}
« no previous file with comments | « tests/isolate/src/MintMakerPromiseTest.dart ('k') | tests/isolate/src/TestFramework.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698