Commit 3ca15ac0 authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Cleanup cert provider tests: delete compareBuffers

Replace the custom handwritten compareBuffers() tool with the commonly
used and more bulletproof chrome.test.assertEq().

Bug: 1078761
Change-Id: Ic30bb450f6922a2fa69297cc60010f4661a4c0a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2246683Reviewed-by: default avatarOmar Morsi <omorsi@google.com>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779759}
parent 8e8eb151
......@@ -30,16 +30,6 @@ function readFile(path, callback) {
oReq.send(null);
}
function compareBuffers(a, b) {
if (a.length != b.length)
return false;
for (var i = 0; i < a.length; i++) {
if (a[i] != b[i])
return false;
}
return true;
}
var signDigestRequest;
var signCallback;
......@@ -59,8 +49,7 @@ function register() {
};
function checkResult(rejectedCerts) {
assertEq(1, rejectedCerts.length);
assertTrue(compareBuffers(invalidCert, new Uint8Array(rejectedCerts[0])));
assertEq([invalidCert.buffer], rejectedCerts);
}
function reportCertificates(reportCallback) {
......@@ -72,8 +61,7 @@ function register() {
chrome.certificateProvider.onSignDigestRequested.addListener(function(
request, callback) {
assertTrue(
compareBuffers(l1_leaf_cert, new Uint8Array(request.certificate)));
assertEq(l1_leaf_cert.buffer, request.certificate);
// The sign request must refer to the only hash that was declared to be
// supported.
assertEq(1, validCertInfo.supportedHashes.length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment