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

Unified Diff: tests/standalone/io/http_proxy_advanced_test.dart

Issue 1890973003: pkg/analyzer: support latest pkg/crypto version (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: nits Created 4 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/io/http_auth_test.dart ('k') | tests/standalone/io/http_proxy_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_proxy_advanced_test.dart
diff --git a/tests/standalone/io/http_proxy_advanced_test.dart b/tests/standalone/io/http_proxy_advanced_test.dart
index 1d2e585ee1d92f509818883049eb3d75de939f1b..7a349d18d4a0fc4e20719c19fd2ca56be2523b3f 100644
--- a/tests/standalone/io/http_proxy_advanced_test.dart
+++ b/tests/standalone/io/http_proxy_advanced_test.dart
@@ -2,6 +2,7 @@
// 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 "package:convert/convert.dart";
import "package:crypto/crypto.dart";
import "package:expect/expect.dart";
import "package:path/path.dart";
@@ -115,9 +116,8 @@ class ProxyServer {
authScheme = "Digest";
// Calculate ha1.
- var hasher = new MD5();
- hasher.add("${username}:${realm}:${password}".codeUnits);
- ha1 = CryptoUtils.bytesToHex(hasher.close());
+ var digest = md5.convert("${username}:${realm}:${password}".codeUnits);
+ ha1 = hex.encode(digest.bytes);
}
basicAuthenticationRequired(request) {
@@ -173,7 +173,7 @@ class ProxyServer {
List<String> tokens = authorization.split(" ");
Expect.equals("Basic", tokens[0]);
String auth =
- CryptoUtils.bytesToBase64(UTF8.encode("$username:$password"));
+ BASE64.encode(UTF8.encode("$username:$password"));
if (auth != tokens[1]) {
basicAuthenticationRequired(request);
return;
@@ -206,19 +206,17 @@ class ProxyServer {
}
Expect.isNotNull(header.parameters["response"]);
- var hasher = new MD5();
- hasher.add("${request.method}:${uri}".codeUnits);
- var ha2 = CryptoUtils.bytesToHex(hasher.close());
+ var digest = md5.convert("${request.method}:${uri}".codeUnits);
+ var ha2 = hex.encode(digest.bytes);
var x;
- hasher = new MD5();
if (qop == null || qop == "" || qop == "none") {
- hasher.add("$ha1:${nonce}:$ha2".codeUnits);
+ digest = md5.convert("$ha1:${nonce}:$ha2".codeUnits);
} else {
- hasher.add(
+ digest = md5.convert(
"$ha1:${nonce}:${nc}:${cnonce}:${qop}:$ha2".codeUnits);
}
- Expect.equals(CryptoUtils.bytesToHex(hasher.close()),
+ Expect.equals(hex.encode(digest.bytes),
header.parameters["response"]);
// Add a bogus Proxy-Authentication-Info for testing.
« no previous file with comments | « tests/standalone/io/http_auth_test.dart ('k') | tests/standalone/io/http_proxy_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698