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

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

Issue 14493015: Add HTTP proxy tunnel support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« sdk/lib/io/http_impl.dart ('K') | « tests/standalone/io/http_proxy_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/socket_upgrade_to_secure_test.dart
diff --git a/tests/standalone/io/socket_upgrade_to_secure_test.dart b/tests/standalone/io/socket_upgrade_to_secure_test.dart
index 33b2059ef9b3ac53a686b6bf8f637ab16145d054..d4448ca1ed59273fd975b5835fbcac29dc5298aa 100644
--- a/tests/standalone/io/socket_upgrade_to_secure_test.dart
+++ b/tests/standalone/io/socket_upgrade_to_secure_test.dart
@@ -12,6 +12,7 @@ import "dart:async";
import "dart:io";
import "dart:isolate";
+const HOST_IP = "127.0.0.1";
const HOST_NAME = "localhost";
const CERTIFICATE = "localhost_cert";
@@ -36,7 +37,8 @@ const CERTIFICATE = "localhost_cert";
// server will not happen until the first TLS handshake data has been
// received from the client. This argument only takes effect when
// handshakeBeforeSecure is true.
-void test(bool handshakeBeforeSecure,
+void test(bool hostnameInConnect,
+ bool handshakeBeforeSecure,
[bool postponeSecure = false]) {
ReceivePort port = new ReceivePort();
@@ -150,17 +152,30 @@ void test(bool handshakeBeforeSecure,
}
Future<SecureSocket> connectClient(int port) {
+ var host = hostnameInConnect ? HOST_NAME : HOST_IP;
if (!handshakeBeforeSecure) {
- return Socket.connect(HOST_NAME, port).then((socket) {
- return SecureSocket.secure(socket).then((secureSocket) {
+ return Socket.connect(host, port).then((socket) {
+ var future;
+ if (hostnameInConnect) {
+ future = SecureSocket.secure(socket);
+ } else {
+ future = SecureSocket.secure(socket, host: HOST_NAME);
+ }
+ return future.then((secureSocket) {
Expect.throws(() => socket.add([0]));
return secureSocket;
});
});
} else {
- return Socket.connect(HOST_NAME, port).then((socket) {
+ return Socket.connect(host, port).then((socket) {
return runClientHandshake(socket).then((_) {
- return SecureSocket.secure(socket).then((secureSocket) {
+ var future;
+ if (hostnameInConnect) {
+ future = SecureSocket.secure(socket);
+ } else {
+ future = SecureSocket.secure(socket, host: HOST_NAME);
+ }
+ return future.then((secureSocket) {
Expect.throws(() => socket.add([0]));
return secureSocket;
});
@@ -203,7 +218,10 @@ main() {
SecureSocket.initialize(database: certificateDatabase.toNativePath(),
password: 'dartdart',
useBuiltinRoots: false);
- test(false);
- test(true);
+ test(false, false);
+ test(true, false);
+ test(false, true);
test(true, true);
+ test(false, true, true);
+ test(true, true, true);
}
« sdk/lib/io/http_impl.dart ('K') | « tests/standalone/io/http_proxy_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698