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

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

Issue 13860006: Fix static type errors in a number of tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:crypto'; 7 import 'dart:crypto';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:uri'; 10 import 'dart:uri';
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 HttpClient client = new HttpClient(); 216 HttpClient client = new HttpClient();
217 217
218 client.authenticate = (Uri url, String scheme, String realm) { 218 client.authenticate = (Uri url, String scheme, String realm) {
219 client.addCredentials( 219 client.addCredentials(
220 Uri.parse("http://127.0.0.1/basic"), 220 Uri.parse("http://127.0.0.1/basic"),
221 "test", 221 "test",
222 new HttpClientBasicCredentials("test", "test")); 222 new HttpClientBasicCredentials("test", "test"));
223 return new Future.value(true); 223 return new Future.value(true);
224 }; 224 };
225 225
226 HttpClientConnection conn = 226 client.getUrl(Uri.parse("http://127.0.0.1/basic/test"))
227 client.getUrl(Uri.parse("http://127.0.0.1/basic/test")); 227 .then((HttpClientRequest request) => request.close())
228 conn.onResponse = (HttpClientResponse response) { 228 .then((HttpClientResponse response) {
229 Expect.equals(HttpStatus.OK, response.statusCode); 229 Expect.equals(HttpStatus.OK, response.statusCode);
230 response.inputStream.onData = () => response.inputStream.read(); 230 response.fold(null, (x, y) {})
231 response.inputStream.onClosed = () { 231 .then((_) {
232 client.shutdown(); 232 client.close();
233 }; 233 });
234 }; 234 });
235 } 235 }
236 236
237 void testLocalServerDigest() { 237 void testLocalServerDigest() {
238 HttpClient client = new HttpClient(); 238 HttpClient client = new HttpClient();
239 239
240 client.authenticate = (Uri url, String scheme, String realm) { 240 client.authenticate = (Uri url, String scheme, String realm) {
241 print("url: $url, scheme: $scheme, realm: $realm"); 241 print("url: $url, scheme: $scheme, realm: $realm");
242 client.addCredentials( 242 client.addCredentials(
243 Uri.parse("http://127.0.0.1/digest"), 243 Uri.parse("http://127.0.0.1/digest"),
244 "test", 244 "test",
245 new HttpClientDigestCredentials("test", "test")); 245 new HttpClientDigestCredentials("test", "test"));
246 return new Future.value(true); 246 return new Future.value(true);
247 }; 247 };
248 248
249 HttpClientConnection conn = 249 client.getUrl(Uri.parse("http://127.0.0.1/digest/test"))
250 client.getUrl(Uri.parse("http://127.0.0.1/digest/test")); 250 .then((HttpClientRequest request) => request.close())
251 conn.onResponse = (HttpClientResponse response) { 251 .then((HttpClientResponse response) {
252 Expect.equals(HttpStatus.OK, response.statusCode); 252 Expect.equals(HttpStatus.OK, response.statusCode);
253 response.inputStream.onData = () => response.inputStream.read(); 253 response.fold(null, (x, y) {})
254 response.inputStream.onClosed = () { 254 .then((_) {
255 client.shutdown(); 255 client.close();
256 }; 256 });
257 }; 257 });
258 } 258 }
259 259
260 main() { 260 main() {
261 testUrlUserInfo(); 261 testUrlUserInfo();
262 testBasicNoCredentials(); 262 testBasicNoCredentials();
263 testBasicCredentials(); 263 testBasicCredentials();
264 testBasicAuthenticateCallback(); 264 testBasicAuthenticateCallback();
265 // These teste are not normally run. They can be used for locally 265 // These teste are not normally run. They can be used for locally
266 // testing with another web server (e.g. Apache). 266 // testing with another web server (e.g. Apache).
267 //testLocalServerBasic(); 267 //testLocalServerBasic();
268 //testLocalServerDigest(); 268 //testLocalServerDigest();
269 } 269 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_test.dart ('k') | tests/standalone/io/raw_secure_server_socket_argument_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698