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

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

Issue 12328037: Add missing files from previous commit (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/io/http_server_response_test.dart ('k') | tests/standalone/io/pipe_server_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/https_client_socket_reuse_test.dart
diff --git a/tests/standalone/io/https_client_socket_reuse_test.dart b/tests/standalone/io/https_client_socket_reuse_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..5b4244b29b90e90012f1678df80cca8b83e759cc
--- /dev/null
+++ b/tests/standalone/io/https_client_socket_reuse_test.dart
@@ -0,0 +1,43 @@
+// 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:async";
+import "dart:io";
+import "dart:uri";
+import "dart:isolate";
+
+// By running tests sequentially, we cover the socket reuse code in HttpClient.
+
+void testGoogleUrls() {
+ int testsStarted = 0;
+ int testsFinished = 0;
+ bool allStarted = false;
+ HttpClient client = new HttpClient();
+
+ Future testUrl(String url) {
+ testsStarted++;
+ var requestUri = Uri.parse(url);
+ return client.getUrl(requestUri)
+ .then((HttpClientRequest request) => request.close())
+ .then((HttpClientResponse response) {
+ Expect.isTrue(response.statusCode < 500);
+ if (requestUri.path.length == 0) {
+ Expect.isTrue(response.statusCode != 404);
+ }
+ return response.reduce(null, (previous, element) => null);
+ })
+ .catchError((error) => Expect.fail("Unexpected IO error: $error"));
+ }
+
+ // TODO(3593): Use a Dart HTTPS server for this test.
+ testUrl('https://www.google.dk')
+ .then((_) => testUrl('https://www.google.dk'))
+ .then((_) => testUrl('https://www.google.dk/#q=foo'))
+ .then((_) => testUrl('https://www.google.dk/#hl=da&q=foo'))
+ .then((_) { client.close(); });
+}
+
+void main() {
+ testGoogleUrls();
+}
« no previous file with comments | « tests/standalone/io/http_server_response_test.dart ('k') | tests/standalone/io/pipe_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698