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

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

Issue 23003023: Remove usage of dart:utf from dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Keep forgiving semantics. Created 7 years, 4 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:crypto/crypto.dart"; 5 import "package:crypto/crypto.dart";
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 import "package:path/path.dart"; 7 import "package:path/path.dart";
8 import "dart:async"; 8 import "dart:async";
9 import "dart:io"; 9 import "dart:io";
10 import 'dart:utf'; 10 import 'dart:convert';
11 11
12 class Server { 12 class Server {
13 HttpServer server; 13 HttpServer server;
14 bool secure; 14 bool secure;
15 int proxyHops; 15 int proxyHops;
16 List<String> directRequestPaths; 16 List<String> directRequestPaths;
17 int requestCount = 0; 17 int requestCount = 0;
18 18
19 Server(this.proxyHops, this.directRequestPaths, this.secure); 19 Server(this.proxyHops, this.directRequestPaths, this.secure);
20 20
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return; 156 return;
157 } else { 157 } else {
158 Expect.equals( 158 Expect.equals(
159 1, request.headers[HttpHeaders.PROXY_AUTHORIZATION].length); 159 1, request.headers[HttpHeaders.PROXY_AUTHORIZATION].length);
160 String authorization = 160 String authorization =
161 request.headers[HttpHeaders.PROXY_AUTHORIZATION][0]; 161 request.headers[HttpHeaders.PROXY_AUTHORIZATION][0];
162 if (authScheme == "Basic") { 162 if (authScheme == "Basic") {
163 List<String> tokens = authorization.split(" "); 163 List<String> tokens = authorization.split(" ");
164 Expect.equals("Basic", tokens[0]); 164 Expect.equals("Basic", tokens[0]);
165 String auth = 165 String auth =
166 CryptoUtils.bytesToBase64(encodeUtf8("$username:$password")); 166 CryptoUtils.bytesToBase64(UTF8.encode("$username:$password"));
167 if (auth != tokens[1]) { 167 if (auth != tokens[1]) {
168 basicAuthenticationRequired(request); 168 basicAuthenticationRequired(request);
169 return; 169 return;
170 } 170 }
171 } else { 171 } else {
172 HeaderValue header = 172 HeaderValue header =
173 HeaderValue.parse( 173 HeaderValue.parse(
174 authorization, parameterSeparator: ","); 174 authorization, parameterSeparator: ",");
175 Expect.equals("Digest", header.value); 175 Expect.equals("Digest", header.value);
176 var uri = header.parameters["uri"]; 176 var uri = header.parameters["uri"];
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 testProxyFromEnviroment(); 760 testProxyFromEnviroment();
761 // The two invocations of uses the same global variable for state - 761 // The two invocations of uses the same global variable for state -
762 // run one after the other. 762 // run one after the other.
763 testProxyAuthenticate(false) 763 testProxyAuthenticate(false)
764 .then((_) => testProxyAuthenticate(true)); 764 .then((_) => testProxyAuthenticate(true));
765 // This test is not normally run. It can be used for locally testing 765 // This test is not normally run. It can be used for locally testing
766 // with a real proxy server (e.g. Apache). 766 // with a real proxy server (e.g. Apache).
767 //testRealProxy(); 767 //testRealProxy();
768 //testRealProxyAuth(); 768 //testRealProxyAuth();
769 } 769 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698