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

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

Issue 8726031: Change handling of accepting socket connections (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/EchoServerStreamTest.dart ('k') | tests/standalone/src/SocketCloseTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/EchoServerTest.dart
diff --git a/tests/standalone/src/EchoServerTest.dart b/tests/standalone/src/EchoServerTest.dart
index 09bb016e04f1e36d6ab3192b188f6539fd66c761..2764400c322e8984c54736ccaeb37daab0e44f03 100644
--- a/tests/standalone/src/EchoServerTest.dart
+++ b/tests/standalone/src/EchoServerTest.dart
@@ -130,8 +130,7 @@ class EchoServer extends TestingServer {
static final msgSize = EchoServerGame.MSGSIZE;
- void connectionHandler() {
- Socket _client;
+ void connectionHandler(Socket connection) {
void messageHandler() {
@@ -139,7 +138,7 @@ class EchoServer extends TestingServer {
int bytesRead = 0;
void handleRead() {
- int read = _client.readList(buffer, bytesRead, msgSize - bytesRead);
+ int read = connection.readList(buffer, bytesRead, msgSize - bytesRead);
if (read > 0) {
bytesRead += read;
if (bytesRead < msgSize) {
@@ -147,7 +146,7 @@ class EchoServer extends TestingServer {
for (int i = 0; i < bytesRead; i++) {
Expect.equals(EchoServerGame.FIRSTCHAR + i, buffer[i]);
}
- _client.dataHandler = handleRead;
+ connection.dataHandler = handleRead;
} else {
// We check every time the whole buffer to verify data integrity.
for (int i = 0; i < msgSize; i++) {
@@ -159,13 +158,13 @@ class EchoServer extends TestingServer {
int bytesWritten = 0;
void handleWrite() {
- int written = _client.writeList(
+ int written = connection.writeList(
buffer, bytesWritten, msgSize - bytesWritten);
bytesWritten += written;
if (bytesWritten < msgSize) {
- _client.writeHandler = handleWrite;
+ connection.writeHandler = handleWrite;
} else {
- _client.close(true);
+ connection.close(true);
}
}
handleWrite();
@@ -179,17 +178,16 @@ class EchoServer extends TestingServer {
}
void closeHandler() {
- _client.close();
+ connection.close();
}
void errorHandler() {
Expect.fail("Socket error");
}
- _client = _server.accept();
- _client.dataHandler = messageHandler;
- _client.closeHandler = closeHandler;
- _client.errorHandler = errorHandler;
+ connection.dataHandler = messageHandler;
+ connection.closeHandler = closeHandler;
+ connection.errorHandler = errorHandler;
}
}
« no previous file with comments | « tests/standalone/src/EchoServerStreamTest.dart ('k') | tests/standalone/src/SocketCloseTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698