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

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

Issue 11299210: Add support for https scheme in dart:io HttpClient. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« sdk/lib/io/http_impl.dart ('K') | « sdk/lib/io/http_impl.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/https_client_test.dart
diff --git a/tests/standalone/io/http_client_test.dart b/tests/standalone/io/https_client_test.dart
similarity index 57%
copy from tests/standalone/io/http_client_test.dart
copy to tests/standalone/io/https_client_test.dart
index 6c3c54976d9cae128f298be66c14f65dc32ea6a8..c17c67a2c76a2b30472725627512345d57f3677b 100644
--- a/tests/standalone/io/http_client_test.dart
+++ b/tests/standalone/io/https_client_test.dart
@@ -6,24 +6,6 @@
#import("dart:uri");
#import("dart:isolate");
-void testGoogle() {
- HttpClient client = new HttpClient();
- var conn = client.get('www.google.com', 80, '/');
-
- conn.onRequest = (HttpClientRequest request) {
- request.outputStream.close();
- };
- conn.onResponse = (HttpClientResponse response) {
- Expect.isTrue(response.statusCode < 500);
- response.inputStream.onData = () {
- response.inputStream.read();
- };
- response.inputStream.onClosed = () {
- client.shutdown();
- };
- };
- conn.onError = (error) => Expect.fail("Unexpected IO error");
-}
int testGoogleUrlCount = 0;
void testGoogleUrl() {
@@ -46,29 +28,22 @@ void testGoogleUrl() {
response.inputStream.read();
};
response.inputStream.onClosed = () {
- if (testGoogleUrlCount == 5) client.shutdown();
+ if (testGoogleUrlCount == 4) client.shutdown();
};
};
conn.onError = (error) => Expect.fail("Unexpected IO error $error");
}
- testUrl('http://www.google.com');
- testUrl('http://www.google.com/abc');
- testUrl('http://www.google.com/?abc');
- testUrl('http://www.google.com/abc?abc');
- testUrl('http://www.google.com/abc?abc#abc');
-}
-
-void testInvalidUrl() {
- HttpClient client = new HttpClient();
- Expect.throws(
- () => client.getUrl(new Uri.fromString('ftp://www.google.com')));
+ testUrl('https://www.google.dk');
+ testUrl('https://www.google.dk');
+ testUrl('https://www.google.dk/#q=foo');
+ testUrl('https://www.google.dk/#hl=da&q=foo');
}
void testBadHostName() {
HttpClient client = new HttpClient();
- HttpClientConnection connection =
- client.get("some.bad.host.name.7654321", 0, "/");
+ HttpClientConnection connection = client.getUrl(
+ new Uri.fromString("https://some.bad.host.name.7654321/"));
connection.onRequest = (HttpClientRequest request) {
Expect.fail("Should not open a request on bad hostname");
};
@@ -78,9 +53,14 @@ void testBadHostName() {
};
}
+void InitializeSSL() {
+ var testPkcertDatabase =
+ new Path.fromNative(new Options().script).directoryPath.append('pkcert/');
+ SecureSocket.setCertificateDatabase(testPkcertDatabase.toNativePath());
+}
+
void main() {
- testGoogle();
+ InitializeSSL();
testGoogleUrl();
- testInvalidUrl();
testBadHostName();
}
« sdk/lib/io/http_impl.dart ('K') | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698