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

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

Issue 11419138: Rename TlsSocket to SecureSocket, and all other Tls... items to Secure.... (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename C++ class from Filter to SSLFilter. Created 8 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/io/secure_stream_test.dart ('k') | tests/standalone/io/tls_server_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/tls_server_stream_test.dart
diff --git a/tests/standalone/io/tls_server_stream_test.dart b/tests/standalone/io/tls_server_stream_test.dart
deleted file mode 100644
index 1b4599124288638679bc3137b4b4e2efe94b86b9..0000000000000000000000000000000000000000
--- a/tests/standalone/io/tls_server_stream_test.dart
+++ /dev/null
@@ -1,98 +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.
-
-import "dart:io";
-
-const SERVER_ADDRESS = "127.0.0.1";
-const HOST_NAME = "localhost";
-
-class TlsTestServer {
- void onConnection(Socket connection) {
- numConnections++;
- var input = connection.inputStream;
- String received = "";
- input.onData = () {
- received = received.concat(new String.fromCharCodes(input.read()));
- };
- input.onClosed = () {
- Expect.isTrue(received.contains("Hello from client "));
- String name = received.substring(received.indexOf("client ") + 7);
- connection.outputStream.write("Welcome, client $name".charCodes);
- connection.outputStream.close();
- };
- }
-
- void errorHandlerServer(Exception e) {
- Expect.fail("Server socket error $e");
- }
-
- int start() {
- server = new TlsServerSocket(SERVER_ADDRESS, 0, 10, "CN=$HOST_NAME");
- Expect.isNotNull(server);
- server.onConnection = onConnection;
- server.onError = errorHandlerServer;
- return server.port;
- }
-
- void stop() {
- server.close();
- }
-
- int numConnections = 0;
- TlsServerSocket server;
-}
-
-class TlsTestClient {
- TlsTestClient(int this.port, String this.name) {
- socket = new TlsSocket(HOST_NAME, port);
- numRequests++;
- socket.outputStream.write("Hello from client $name".charCodes);
- socket.outputStream.close();
- socket.inputStream.onData = () {
- reply = reply.concat(new String.fromCharCodes(socket.inputStream.read()));
- };
- socket.inputStream.onClosed = this.done;
- reply = "";
- }
-
- void done() {
- Expect.equals("Welcome, client $name", reply);
- numReplies++;
- if (numReplies == CLIENT_NAMES.length) {
- Expect.equals(numRequests, numReplies);
- EndTest();
- }
- }
-
- static int numRequests = 0;
- static int numReplies = 0;
-
- int port;
- String name;
- TlsSocket socket;
- String reply;
-}
-
-Function EndTest;
-
-const CLIENT_NAMES = const ['able', 'baker', 'camera', 'donut', 'echo'];
-
-void main() {
- Path scriptDir = new Path.fromNative(new Options().script).directoryPath;
- Path certificateDatabase = scriptDir.append('pkcert');
- TlsSocket.setCertificateDatabase(certificateDatabase.toNativePath(),
- 'dartdart');
-
- var server = new TlsTestServer();
- int port = server.start();
-
- EndTest = () {
- Expect.equals(CLIENT_NAMES.length, server.numConnections);
- server.stop();
- };
-
- for (var x in CLIENT_NAMES) {
- new TlsTestClient(port, x);
- }
-}
« no previous file with comments | « tests/standalone/io/secure_stream_test.dart ('k') | tests/standalone/io/tls_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698