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

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

Issue 8437090: Change the handling of closing sockets (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments by ager@ 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 | « runtime/bin/socket_stream.dart ('k') | tests/standalone/src/EchoServerTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/EchoServerStreamTest.dart
diff --git a/tests/standalone/src/EchoServerStreamTest.dart b/tests/standalone/src/EchoServerStreamTest.dart
index 7bae9078bf92add866c650737b39ede132ac7521..992c42262d2a48c62df718542677bac94b8a6368 100644
--- a/tests/standalone/src/EchoServerStreamTest.dart
+++ b/tests/standalone/src/EchoServerStreamTest.dart
@@ -21,7 +21,7 @@ class EchoServerGame {
static final MSGSIZE = 10;
static final SERVERINIT = 0;
static final SERVERSHUTDOWN = -1;
- static final MESSAGES = 200;
+ static final MESSAGES = 100;
static final FIRSTCHAR = 65;
EchoServerGame.start()
@@ -45,8 +45,7 @@ class EchoServerGame {
}
void errorHandler() {
- print("Socket error");
- _socket.close();
+ Expect.fail("Socket error");
}
void connectHandler() {
@@ -93,6 +92,7 @@ class EchoServerGame {
_socket.closeHandler = closeHandler;
_socket.errorHandler = errorHandler;
stream.write(_buffer);
+ stream.close();
dataSent();
}
@@ -139,8 +139,10 @@ class EchoServer extends Isolate {
int offset = 0;
void dataReceived() {
- SocketOutputStream outputStream = _client.outputStream;
- int bytesRead = inputStream.readInto(buffer, offset, MSGSIZE - offset);
+ SocketOutputStream outputStream;
+ int bytesRead;
+ outputStream = _client.outputStream;
+ bytesRead = inputStream.readInto(buffer, offset, MSGSIZE - offset);
if (bytesRead > 0) {
offset += bytesRead;
for (int i = 0; i < offset; i++) {
@@ -148,29 +150,23 @@ class EchoServer extends Isolate {
}
if (offset == MSGSIZE) {
outputStream.write(buffer);
+ outputStream.close();
}
}
}
- void closeHandler() {
- _client.close();
- }
-
void errorHandler() {
- print("Socket error");
- _client.close();
+ Expect.fail("Socket error");
}
_client = _server.accept();
inputStream = _client.inputStream;
inputStream.dataHandler = dataReceived;
- _client.closeHandler = closeHandler;
_client.errorHandler = errorHandler;
}
void errorHandlerServer() {
- print("Server socket error");
- _server.close();
+ Expect.fail("Server socket error");
}
this.port.receive((message, SendPort replyTo) {
« no previous file with comments | « runtime/bin/socket_stream.dart ('k') | tests/standalone/src/EchoServerTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698