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

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

Issue 201993002: Fix SecureSocket tests to look up localhost only once, where possible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove useless change to https_client_certificate_test.dart Created 6 years, 9 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 | « sdk/lib/io/secure_server_socket.dart ('k') | tests/standalone/io/raw_secure_server_closing_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/https_server_test.dart
diff --git a/tests/standalone/io/https_server_test.dart b/tests/standalone/io/https_server_test.dart
index 559a4d15bbd47a9d391a2b3a3d177e62d003db99..cdba0642167086a57cd17f0d42115b1f1cdf2848 100644
--- a/tests/standalone/io/https_server_test.dart
+++ b/tests/standalone/io/https_server_test.dart
@@ -2,20 +2,21 @@
// 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 "package:expect/expect.dart";
-import "package:path/path.dart";
import "dart:async";
import "dart:io";
import "dart:isolate";
-const HOST_NAME = "localhost";
+import "package:expect/expect.dart";
+
+InternetAddress HOST;
+const CERTIFICATE = "localhost_cert";
void testListenOn() {
void test(void onDone()) {
- HttpServer.bindSecure(HOST_NAME,
+ HttpServer.bindSecure(HOST,
0,
backlog: 5,
- certificateName: 'localhost_cert').then((server) {
+ certificateName: CERTIFICATE).then((server) {
ReceivePort serverPort = new ReceivePort();
server.listen((HttpRequest request) {
request.listen(
@@ -28,7 +29,7 @@ void testListenOn() {
HttpClient client = new HttpClient();
ReceivePort clientPort = new ReceivePort();
- client.getUrl(Uri.parse("https://$HOST_NAME:${server.port}/"))
+ client.getUrl(Uri.parse("https://${HOST.host}:${server.port}/"))
.then((HttpClientRequest request) {
return request.close();
})
@@ -64,7 +65,7 @@ void InitializeSSL() {
}
void testEarlyClientClose() {
- HttpServer.bindSecure(HOST_NAME,
+ HttpServer.bindSecure(HOST,
0,
certificateName: 'localhost_cert').then((server) {
server.listen(
@@ -76,7 +77,7 @@ void testEarlyClientClose() {
var count = 0;
makeRequest() {
- Socket.connect(HOST_NAME, server.port).then((socket) {
+ Socket.connect(HOST, server.port).then((socket) {
var data = "Invalid TLS handshake";
socket.write(data);
socket.close();
@@ -96,6 +97,9 @@ void testEarlyClientClose() {
void main() {
InitializeSSL();
- testListenOn();
- testEarlyClientClose();
+ InternetAddress.lookup("localhost").then((hosts) {
+ HOST = hosts.first;
+ testListenOn();
+ testEarlyClientClose();
+ });
}
« no previous file with comments | « sdk/lib/io/secure_server_socket.dart ('k') | tests/standalone/io/raw_secure_server_closing_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698