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

Unified Diff: LayoutTests/crypto/digest.html

Issue 42743004: [webcrypto] Add more layouttests for AES-CBC. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 | « no previous file | LayoutTests/crypto/encrypt-decrypt.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/crypto/digest.html
diff --git a/LayoutTests/crypto/digest.html b/LayoutTests/crypto/digest.html
index 9cc1a0e696f47172290d82865496288191caaf30..eb61d5286818db0086106ff9189f7101b7332dca 100644
--- a/LayoutTests/crypto/digest.html
+++ b/LayoutTests/crypto/digest.html
@@ -98,24 +98,23 @@ kDigestTestVectors = [
},
];
+var allTests = [];
+
// Run each test.
for (var i = 0; i < kDigestTestVectors.length; ++i) {
- var testCase = kDigestTestVectors[i];
- var promise = crypto.subtle.digest({name: testCase.algorithm}, hexStringToUint8Array(testCase.input));
- promise.then(onTestCaseComplete.bind(null, testCase), failAndFinishJSTest);
+ allTests.push(runTestCase(kDigestTestVectors[i]));
}
-function onTestCaseComplete(testCase, result)
+function runTestCase(testCase)
{
- var testDescription = testCase.algorithm + " of [" + testCase.input + "]";
- bytesShouldMatchHexString(testDescription, testCase.output, result);
-
- // Once the last test has completed, done.
- if (testCase == kDigestTestVectors[kDigestTestVectors.length - 1]) {
- finishJSTest();
- }
+ return crypto.subtle.digest({name: testCase.algorithm}, hexStringToUint8Array(testCase.input)).then(function(result) {
+ var testDescription = testCase.algorithm + " of [" + testCase.input + "]";
+ bytesShouldMatchHexString(testDescription, testCase.output, result);
+ });
}
+Promise.all(allTests).then(finishJSTest, failAndFinishJSTest);
+
// Pass invalid data to digeset()
shouldThrow("crypto.subtle.digest({name: 'sha-1'})");
shouldThrow("crypto.subtle.digest({name: 'sha-1'}, null)");
« no previous file with comments | « no previous file | LayoutTests/crypto/encrypt-decrypt.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698