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

Unified Diff: tests/standalone/src/io/TestingServer.dart

Issue 10252020: test rename overhaul: step 12 - standalone (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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/src/io/TestRunnerTest.dart ('k') | tests/standalone/src/io/TimerCancel1Test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/io/TestingServer.dart
diff --git a/tests/standalone/src/io/TestingServer.dart b/tests/standalone/src/io/TestingServer.dart
deleted file mode 100644
index b46a62ddc4642ab87eb53487128148cb7e009972..0000000000000000000000000000000000000000
--- a/tests/standalone/src/io/TestingServer.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2012, 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.
-
-class TestingServer extends Isolate {
-
- static final HOST = "127.0.0.1";
- static final INIT = 0;
- static final SHUTDOWN = -1;
-
- abstract void onConnection(Socket connection);
-
- void main() {
- 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();
- }
- });
- }
-
- ServerSocket _server;
-}
-
-class TestingServerTest {
-
- TestingServerTest.start(TestingServer server)
- : _receivePort = new ReceivePort(),
- _sendPort = null {
- server.spawn().then((SendPort port) {
- _sendPort = port;
- start();
- });
- }
-
- abstract void run();
-
- void start() {
- _receivePort.receive((var message, SendPort replyTo) {
- _port = message;
- run();
- });
- _sendPort.send(TestingServer.INIT, _receivePort.toSendPort());
- }
-
- void shutdown() {
- _sendPort.send(TestingServer.SHUTDOWN, _receivePort.toSendPort());
- _receivePort.close();
- }
-
- int _port;
- ReceivePort _receivePort;
- SendPort _sendPort;
-}
« no previous file with comments | « tests/standalone/src/io/TestRunnerTest.dart ('k') | tests/standalone/src/io/TimerCancel1Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698