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

Unified Diff: tests/standalone/src/io/SocketManyConnectionsTest.dart

Issue 10252020: test rename overhaul: step 12 - standalone (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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/src/io/SocketInfoTest.dart ('k') | tests/standalone/src/io/SocketPortTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/io/SocketManyConnectionsTest.dart
diff --git a/tests/standalone/src/io/SocketManyConnectionsTest.dart b/tests/standalone/src/io/SocketManyConnectionsTest.dart
deleted file mode 100644
index 0ee1cdc8a19ff81645cfa2116a8e7b1ee93d72b8..0000000000000000000000000000000000000000
--- a/tests/standalone/src/io/SocketManyConnectionsTest.dart
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-//
-// Test creating a large number of socket connections.
-
-#import("dart:io");
-#import("dart:isolate");
-#source("TestingServer.dart");
-
-final CONNECTIONS = 200;
-
-class SocketManyConnectionsTest {
-
- SocketManyConnectionsTest.start()
- : _receivePort = new ReceivePort(),
- _sendPort = null,
- _connections = 0,
- _sockets = new List<Socket>(CONNECTIONS) {
- new TestServer().spawn().then((SendPort port) {
- _sendPort = port;
- start();
- });
- }
-
- void run() {
-
- void connectHandler() {
- _connections++;
- if (_connections == CONNECTIONS) {
- for (int i = 0; i < CONNECTIONS; i++) {
- _sockets[i].close();
- }
- shutdown();
- }
- }
-
- 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");
- }
- }
- }
-
- void start() {
- _receivePort.receive((var message, SendPort replyTo) {
- _port = message;
- run();
- });
- _sendPort.send(TestingServer.INIT, _receivePort.toSendPort());
- }
-
- void shutdown() {
- _sendPort.send(TestingServer.SHUTDOWN, _receivePort.toSendPort());
- _receivePort.close();
- }
-
- int _port;
- ReceivePort _receivePort;
- SendPort _sendPort;
- List<Socket> _sockets;
- int _connections;
-}
-
-class TestServer extends TestingServer {
-
- void onConnection(Socket connection) {
- Socket _client;
-
- void closeHandler() {
- connection.close();
- }
-
- void errorHandler(Exception e) {
- print("Socket error $e");
- connection.close();
- }
-
- _connections++;
- connection.onClosed = closeHandler;
- connection.onError = errorHandler;
- }
-
- int _connections = 0;
-}
-
-main() {
- SocketManyConnectionsTest test = new SocketManyConnectionsTest.start();
-}
« no previous file with comments | « tests/standalone/src/io/SocketInfoTest.dart ('k') | tests/standalone/src/io/SocketPortTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698