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

Unified Diff: tests/standalone/io/http_auth_digest_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/addlatexhash_test.dart ('k') | tests/standalone/io/http_auth_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_auth_digest_test.dart
diff --git a/tests/standalone/io/http_auth_digest_test.dart b/tests/standalone/io/http_auth_digest_test.dart
index 5512cd02d2f874f99cc1c405ea6d61400d5d2481..6a902b018b0e22b9c7d887858217b253e83c79eb 100644
--- a/tests/standalone/io/http_auth_digest_test.dart
+++ b/tests/standalone/io/http_auth_digest_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 'dart:async';
@@ -31,9 +32,8 @@ class Server {
String realm = "test";
String username = "dart";
String password = "password";
- var hasher = new MD5();
- hasher.add("${username}:${realm}:${password}".codeUnits);
- ha1 = CryptoUtils.bytesToHex(hasher.close());
+ var hasher = md5.convert("${username}:${realm}:${password}".codeUnits);
+ ha1 = hex.encode(hasher.bytes);
var nonce = "12345678"; // No need for random nonce in test.
@@ -96,18 +96,17 @@ class Server {
}
Expect.isNotNull(header.parameters["response"]);
- var hasher = new MD5();
- hasher.add("${request.method}:${uri}".codeUnits);
- var ha2 = CryptoUtils.bytesToHex(hasher.close());
+ var hasher = md5.convert("${request.method}:${uri}".codeUnits);
+ var ha2 = hex.encode(hasher.bytes);
var x;
- hasher = new MD5();
+ Digest digest;
if (qop == null || qop == "" || qop == "none") {
- hasher.add("$ha1:${nonce}:$ha2".codeUnits);
+ digest = md5.convert("$ha1:${nonce}:$ha2".codeUnits);
} else {
- hasher.add("$ha1:${nonce}:${nc}:${cnonce}:${qop}:$ha2".codeUnits);
+ 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"]);
successCount++;
« no previous file with comments | « tests/standalone/io/addlatexhash_test.dart ('k') | tests/standalone/io/http_auth_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698