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

Side by Side Diff: tests/standalone/io/http_client_test.dart

Issue 11118021: Add support for authorization of HTTP client requests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ajohnsen@ 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import("dart:io"); 5 #import("dart:io");
6 #import("dart:uri"); 6 #import("dart:uri");
7 #import("dart:isolate"); 7 #import("dart:isolate");
8 8
9 void testGoogle() { 9 void testGoogle() {
10 HttpClient client = new HttpClient(); 10 HttpClient client = new HttpClient();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 testUrl('http://www.google.com/abc'); 56 testUrl('http://www.google.com/abc');
57 testUrl('http://www.google.com/?abc'); 57 testUrl('http://www.google.com/?abc');
58 testUrl('http://www.google.com/abc?abc'); 58 testUrl('http://www.google.com/abc?abc');
59 testUrl('http://www.google.com/abc?abc#abc'); 59 testUrl('http://www.google.com/abc?abc#abc');
60 } 60 }
61 61
62 void testInvalidUrl() { 62 void testInvalidUrl() {
63 HttpClient client = new HttpClient(); 63 HttpClient client = new HttpClient();
64 Expect.throws( 64 Expect.throws(
65 () => client.getUrl(new Uri.fromString('ftp://www.google.com'))); 65 () => client.getUrl(new Uri.fromString('ftp://www.google.com')));
66 Expect.throws(
67 () => client.getUrl(new Uri.fromString('http://usr:pwd@www.google.com')));
68 } 66 }
69 67
70 void testBadHostName() { 68 void testBadHostName() {
71 HttpClient client = new HttpClient(); 69 HttpClient client = new HttpClient();
72 HttpClientConnection connection = 70 HttpClientConnection connection =
73 client.get("some.bad.host.name.7654321", 0, "/"); 71 client.get("some.bad.host.name.7654321", 0, "/");
74 connection.onRequest = (HttpClientRequest request) { 72 connection.onRequest = (HttpClientRequest request) {
75 Expect.fail("Should not open a request on bad hostname"); 73 Expect.fail("Should not open a request on bad hostname");
76 }; 74 };
77 ReceivePort port = new ReceivePort(); 75 ReceivePort port = new ReceivePort();
78 connection.onError = (Exception error) { 76 connection.onError = (Exception error) {
79 port.close(); // We expect onError to be called, due to bad host name. 77 port.close(); // We expect onError to be called, due to bad host name.
80 }; 78 };
81 } 79 }
82 80
83 void main() { 81 void main() {
84 testGoogle(); 82 testGoogle();
85 testGoogleUrl(); 83 testGoogleUrl();
86 testInvalidUrl(); 84 testInvalidUrl();
87 testBadHostName(); 85 testBadHostName();
88 } 86 }
OLDNEW
« runtime/bin/http.dart ('K') | « tests/standalone/io/http_auth_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698