| 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]);
|
| -}
|
|
|