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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/src/SocketManyConnectionsTest.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 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.
2
3 static final HOST = "127.0.0.1";
4 static final INIT = 0;
5 static final SHUTDOWN = -1;
6
7 abstract void connectionHandler();
8
9 void main() {
10 void errorHandlerServer() {
11 Expect.fail("Server socket error");
12 }
13
14 this.port.receive((message, SendPort replyTo) {
15 if (message == INIT) {
16 _server = new ServerSocket(HOST, 0, 10);
17 Expect.equals(true, _server !== null);
18 _server.connectionHandler = connectionHandler;
19 _server.errorHandler = errorHandlerServer;
20 replyTo.send(_server.port, null);
21 } else if (message == SHUTDOWN) {
22 _server.close();
23 this.port.close();
24 }
25 });
26 }
27
28 ServerSocket _server;
29 }
OLDNEW
« 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