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

Unified Diff: tests/standalone/src/io/HttpClientTest.dart

Issue 10252020: test rename overhaul: step 12 - standalone (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « tests/standalone/src/io/FileTest.dart ('k') | tests/standalone/src/io/HttpContentLengthTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/io/HttpClientTest.dart
diff --git a/tests/standalone/src/io/HttpClientTest.dart b/tests/standalone/src/io/HttpClientTest.dart
deleted file mode 100644
index c2f90c2cecbe7f428cffdfbed450d7f70abfd020..0000000000000000000000000000000000000000
--- a/tests/standalone/src/io/HttpClientTest.dart
+++ /dev/null
@@ -1,84 +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 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");
-}
-
-void testGoogleUrl() {
- HttpClient client = new HttpClient();
-
- void testUrl(String url) {
- var conn = client.getUrl(new Uri.fromString(url));
-
- 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");
- }
-
- 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')));
- Expect.throws(
- () => client.getUrl(new Uri.fromString('http://usr:pwd@www.google.com')));
-}
-
-void testBadHostName() {
- HttpClient client = new HttpClient();
- HttpClientConnection connection =
- client.get("some.bad.host.name.7654321", 0, "/");
- connection.onRequest = (HttpClientRequest request) {
- Expect.fail("Should not open a request on bad hostname");
- };
- ReceivePort port = new ReceivePort();
- connection.onError = (Exception error) {
- port.close(); // We expect onError to be called, due to bad host name.
- };
-}
-
-void main() {
- // TODO(sgjesse): Making empty www.google.com requests seems to fail
- //on buildbot.
- //testGoogle();
- //testGoogleUrl();
- testInvalidUrl();
- testBadHostName();
-}
« no previous file with comments | « tests/standalone/src/io/FileTest.dart ('k') | tests/standalone/src/io/HttpContentLengthTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698