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

Unified Diff: tests/standalone/io/socket_many_connections_test.dart

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 years, 10 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/io/socket_invalid_arguments_test.dart ('k') | tests/standalone/io/socket_port_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/socket_many_connections_test.dart
diff --git a/tests/standalone/io/socket_many_connections_test.dart b/tests/standalone/io/socket_many_connections_test.dart
index 3aabf60c6ea627db059b2080481fc37a58751e89..c313fe1ed785556dca715a18e501cacaad302769 100644
--- a/tests/standalone/io/socket_many_connections_test.dart
+++ b/tests/standalone/io/socket_many_connections_test.dart
@@ -28,19 +28,18 @@ class SocketManyConnectionsTest {
_connections++;
if (_connections == CONNECTIONS) {
for (int i = 0; i < CONNECTIONS; i++) {
- _sockets[i].close();
+ _sockets[i].destroy();
}
- shutdown();
+ close();
}
}
for (int i = 0; i < CONNECTIONS; i++) {
- _sockets[i] = new Socket(TestingServer.HOST, _port);
- if (_sockets[i] != null) {
- _sockets[i].onConnect = connectHandler;
- } else {
- Expect.fail("socket creation failed");
- }
+ Socket.connect(TestingServer.HOST, _port).then((socket) {
+ Expect.isNotNull(socket);
+ _sockets[i] = socket;
+ connectHandler();
+ });
}
}
@@ -52,7 +51,7 @@ class SocketManyConnectionsTest {
_sendPort.send(TestingServer.INIT, _receivePort.toSendPort());
}
- void shutdown() {
+ void close() {
_sendPort.send(TestingServer.SHUTDOWN, _receivePort.toSendPort());
_receivePort.close();
}
@@ -79,14 +78,16 @@ class TestServer extends TestingServer {
connection.close();
}
- void errorHandler(Exception e) {
+ void errorHandler(e) {
print("Socket error $e");
connection.close();
}
_connections++;
- connection.onClosed = closeHandler;
- connection.onError = errorHandler;
+ connection.listen(
+ (data) {},
+ onDone: closeHandler,
+ onError: errorHandler);
}
int _connections = 0;
« no previous file with comments | « tests/standalone/io/socket_invalid_arguments_test.dart ('k') | tests/standalone/io/socket_port_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698