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

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

Issue 8662038: Refactor some of the duplicated code in the tests using a socket server (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor fix Created 9 years, 1 month 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/SocketManyConnectionsTest.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/TestingServer.dart
diff --git a/tests/standalone/src/TestingServer.dart b/tests/standalone/src/TestingServer.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a5ff00519ccf35d90ed51f514de4e6634cf4817d
--- /dev/null
+++ b/tests/standalone/src/TestingServer.dart
@@ -0,0 +1,29 @@
+class TestingServer extends Isolate {
Mads Ager (google) 2011/11/24 12:01:42 Please add copyright header.
Søren Gjesse 2011/11/24 12:11:16 Done.
+
+ static final HOST = "127.0.0.1";
+ static final INIT = 0;
+ static final SHUTDOWN = -1;
+
+ abstract void connectionHandler();
+
+ void main() {
+ void errorHandlerServer() {
+ Expect.fail("Server socket error");
+ }
+
+ this.port.receive((message, SendPort replyTo) {
+ if (message == INIT) {
+ _server = new ServerSocket(HOST, 0, 10);
+ Expect.equals(true, _server !== null);
+ _server.connectionHandler = connectionHandler;
+ _server.errorHandler = errorHandlerServer;
+ replyTo.send(_server.port, null);
+ } else if (message == SHUTDOWN) {
+ _server.close();
+ this.port.close();
+ }
+ });
+ }
+
+ ServerSocket _server;
+}
« no previous file with comments | « tests/standalone/src/SocketManyConnectionsTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698