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

Unified Diff: tests/standalone/io/testing_server.dart

Issue 10837070: Remove old isolate API and update all code in the repository to use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 5 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/standalone/io/stream_pipe_test.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/testing_server.dart
diff --git a/tests/standalone/io/testing_server.dart b/tests/standalone/io/testing_server.dart
index b46a62ddc4642ab87eb53487128148cb7e009972..2ff844949d4995b75076bedfd11e8ff75b35009c 100644
--- a/tests/standalone/io/testing_server.dart
+++ b/tests/standalone/io/testing_server.dart
@@ -2,7 +2,7 @@
// 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.
-class TestingServer extends Isolate {
+class TestingServer {
static final HOST = "127.0.0.1";
static final INIT = 0;
@@ -10,23 +10,21 @@ class TestingServer extends Isolate {
abstract void onConnection(Socket connection);
- void main() {
- void errorHandlerServer(Exception e) {
- Expect.fail("Server socket error $e");
- }
+ void errorHandlerServer(Exception e) {
+ Expect.fail("Server socket error $e");
+ }
- this.port.receive((message, SendPort replyTo) {
- if (message == INIT) {
- _server = new ServerSocket(HOST, 0, 10);
- Expect.equals(true, _server !== null);
- _server.onConnection = onConnection;
- _server.onError = errorHandlerServer;
- replyTo.send(_server.port, null);
- } else if (message == SHUTDOWN) {
- _server.close();
- this.port.close();
- }
- });
+ void dispatch(message, SendPort replyTo) {
+ if (message == INIT) {
+ _server = new ServerSocket(HOST, 0, 10);
+ Expect.equals(true, _server !== null);
+ _server.onConnection = onConnection;
+ _server.onError = errorHandlerServer;
+ replyTo.send(_server.port, null);
+ } else if (message == SHUTDOWN) {
+ _server.close();
+ port.close();
+ }
}
ServerSocket _server;
@@ -34,13 +32,10 @@ class TestingServer extends Isolate {
class TestingServerTest {
- TestingServerTest.start(TestingServer server)
+ TestingServerTest.start(SendPort port)
: _receivePort = new ReceivePort(),
- _sendPort = null {
- server.spawn().then((SendPort port) {
- _sendPort = port;
- start();
- });
+ _sendPort = port {
+ start();
}
abstract void run();
« no previous file with comments | « tests/standalone/io/stream_pipe_test.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698