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

Unified Diff: LayoutTests/crypto/sign-verify.html

Issue 209853010: [ABANDONED] Enable V8 Promises (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
Index: LayoutTests/crypto/sign-verify.html
diff --git a/LayoutTests/crypto/sign-verify.html b/LayoutTests/crypto/sign-verify.html
index d99f77223f1381b5fe4e638e7f2928ef0e7330a9..d25153327fef8e610dfbd31ab996459681faf5c9 100644
--- a/LayoutTests/crypto/sign-verify.html
+++ b/LayoutTests/crypto/sign-verify.html
@@ -14,8 +14,10 @@ description("Tests cypto.subtle.sign and crypto.subtle.verify");
jsTestIsAsync = true;
-// A list of Promises for every test to run.
-var allTests = [];
+var runTests;
+var allTests = new Promise(function(resolve) {
+ runTests = resolve;
+});
// -------------------------------------------------
// Successful sign/verify for HMAC
@@ -119,14 +121,18 @@ function runSuccessTestCase(testCase)
}
// Add all of the tests defined above.
-for (var i = 0; i < kHmacTestVectors.length; ++i) {
- allTests.push(runSuccessTestCase(kHmacTestVectors[i]));
-}
+kHmacTestVectors.forEach(function(data) {
+ allTests = allTests.then(function() {
+ return runSuccessTestCase(data);
+ });
+});
hmac = {name: 'hmac'};
data = asciiToUint8Array("hello");
-allTests.push(importTestKeys().then(function(importedKeys) {
+allTests = allTests.then(function() {
eroman 2014/03/26 09:07:58 In fact I have a similar changelist pending which
+ return importTestKeys();
+}).then(function(importedKeys) {
keys = importedKeys;
// Pass invalid signature parameters to verify()
@@ -140,13 +146,13 @@ allTests.push(importTestKeys().then(function(importedKeys) {
// Operation doesn't support signing (also given an invalid key, but the
// first failure takes priority)
shouldRejectPromiseWithNull("crypto.subtle.sign({name: 'RSAES-PKCS1-v1_5'}, keys.hmacSha1, data)");
-}));
+});
// -------------------------------------------------
// Wait until all the tests have been run.
// -------------------------------------------------
-
-Promise.all(allTests).then(finishJSTest, failAndFinishJSTest);
+allTests = allTests.then(finishJSTest, failAndFinishJSTest);
+runTests();
</script>

Powered by Google App Engine
This is Rietveld 408576698