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

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

Issue 12330133: Don't use external servers in the tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed long lines 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
Index: tests/standalone/io/https_client_test.dart
diff --git a/tests/standalone/io/https_client_test.dart b/tests/standalone/io/https_client_test.dart
deleted file mode 100644
index 37b3d4f01779014606e65efb13d1f8a9f8238a51..0000000000000000000000000000000000000000
--- a/tests/standalone/io/https_client_test.dart
+++ /dev/null
@@ -1,60 +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";
-import "dart:uri";
-import "dart:isolate";
-
-
-void testGoogleUrl() {
- int testsStarted = 0;
- int testsFinished = 0;
- bool allStarted = false;
- HttpClient client = new HttpClient();
-
- void testUrl(String url) {
- testsStarted++;
- var requestUri = Uri.parse(url);
- 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);
- }
- response.listen((data) { }, onDone: () {
- if (++testsFinished == testsStarted && allStarted) client.close();
- });
- })
- .catchError((error) => Expect.fail("Unexpected IO error: $error"));
- }
-
- 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');
- allStarted = true;
-}
-
-void testBadHostName() {
- HttpClient client = new HttpClient();
- ReceivePort port = new ReceivePort();
- client.getUrl(Uri.parse("https://some.bad.host.name.7654321/"))
- .then((HttpClientRequest request) {
- Expect.fail("Should not open a request on bad hostname");
- })
- .catchError((error) {
- port.close(); // Should throw an error on bad hostname.
- });
-}
-
-void InitializeSSL() {
- SecureSocket.initialize();
-}
-
-void main() {
- testGoogleUrl();
- testBadHostName();
- Expect.throws(InitializeSSL);
-}

Powered by Google App Engine
This is Rietveld 408576698