| 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)");
|
|
|