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

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

Issue 12213092: Rework Timer interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 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:async'; 5 import 'dart:async';
6 import 'dart:crypto'; 6 import 'dart:crypto';
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 import 'dart:uri'; 9 import 'dart:uri';
10 import 'dart:utf'; 10 import 'dart:utf';
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 HttpClient client = new HttpClient(); 161 HttpClient client = new HttpClient();
162 bool passwordChanged = false; 162 bool passwordChanged = false;
163 163
164 client.authenticate = (Uri url, String scheme, String realm) { 164 client.authenticate = (Uri url, String scheme, String realm) {
165 Expect.equals("Basic", scheme); 165 Expect.equals("Basic", scheme);
166 Expect.equals("realm", realm); 166 Expect.equals("realm", realm);
167 String username = url.path.substring(1, 6); 167 String username = url.path.substring(1, 6);
168 String password = url.path.substring(1, 6); 168 String password = url.path.substring(1, 6);
169 if (passwordChanged) password = "${password}1"; 169 if (passwordChanged) password = "${password}1";
170 Completer completer = new Completer(); 170 Completer completer = new Completer();
171 new Timer(10, (_) { 171 new Timer(const Duration(milliseconds: 10), () {
172 client.addCredentials( 172 client.addCredentials(
173 url, realm, new HttpClientBasicCredentials(username, password)); 173 url, realm, new HttpClientBasicCredentials(username, password));
174 completer.complete(true); 174 completer.complete(true);
175 }); 175 });
176 return completer.future; 176 return completer.future;
177 }; 177 };
178 178
179 Future makeRequest(Uri url) { 179 Future makeRequest(Uri url) {
180 Completer completer = new Completer(); 180 Completer completer = new Completer();
181 HttpClientConnection conn = client.getUrl(url); 181 HttpClientConnection conn = client.getUrl(url);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 main() { 262 main() {
263 testUrlUserInfo(); 263 testUrlUserInfo();
264 testBasicNoCredentials(); 264 testBasicNoCredentials();
265 testBasicCredentials(); 265 testBasicCredentials();
266 testBasicAuthenticateCallback(); 266 testBasicAuthenticateCallback();
267 // These teste are not normally run. They can be used for locally 267 // These teste are not normally run. They can be used for locally
268 // testing with another web server (e.g. Apache). 268 // testing with another web server (e.g. Apache).
269 //testLocalServerBasic(); 269 //testLocalServerBasic();
270 //testLocalServerDigest(); 270 //testLocalServerDigest();
271 } 271 }
OLDNEW
« no previous file with comments | « tests/lib/async/slow_consumer_test.dart ('k') | tests/standalone/io/http_connection_close_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698