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

Unified Diff: LayoutTests/crypto/aes-generateKey.html

Issue 806913006: [WebCrypto] Move LayoutTests from crypto to crypto/subtle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update path for deserialize legacy tests Created 6 years 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/aes-generateKey.html
diff --git a/LayoutTests/crypto/aes-generateKey.html b/LayoutTests/crypto/aes-generateKey.html
deleted file mode 100644
index 4b73adba110f942f018bb6620d5f004f6151e6c9..0000000000000000000000000000000000000000
--- a/LayoutTests/crypto/aes-generateKey.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<script src="../resources/js-test.js"></script>
-<script src="resources/common.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-description("Tests generating AES keys");
-
-jsTestIsAsync = true;
-
-// Tests the 24 permutations of keys generated by:
-// kPossibleAlgorithms x kPossibleExtractable x kPossibleKeyUsages x kPossibleKeyLengths
-//
-// For practical reasons these tests are not exhaustive.
-
-var kPossibleAlgorithms = ['AES-CBC', 'AES-GCM'];
-var kPossibleExtractable = [true, false];
-var kPossibleKeyUsages = [['encrypt'], ['decrypt', 'wrapKey'], ['encrypt', 'wrapKey', 'unwrapKey']];
-var kPossibleKeyLengths = [128, 256];
-
-// Set of all key data generated so far.
-var allKeyDataGenerated = {};
-
-function runTest(algorithmName, extractable, keyUsages, keyLengthBits)
-{
- var genAlgorithm = { name: algorithmName, length: keyLengthBits };
-
- var results = {};
-
- var promise = crypto.subtle.generateKey(genAlgorithm, extractable, keyUsages).then(function(result) {
- generatedKey = result;
-
- shouldEvaluateAs("generatedKey.extractable", extractable);
- shouldEvaluateAs("generatedKey.algorithm.name", algorithmName);
- shouldEvaluateAs("generatedKey.algorithm.length", keyLengthBits);
- shouldEvaluateAs("generatedKey.usages.join(',')", keyUsages.join(","));
-
- if (extractable)
- return crypto.subtle.exportKey('raw', generatedKey);
- });
-
- if (extractable) {
- promise = promise.then(function(result) {
- keyData = result;
- shouldEvaluateAs("keyData.byteLength", keyLengthBits / 8);
-
- var keyDataHex = bytesToHexString(keyData);
-
- // It is very unlikely to generate two identical keys, so
- // assume if that happens something is broken.
- // (8 extractable keys are generated for each bit length).
- if (allKeyDataGenerated[keyDataHex]) {
- testFailed("Generated identical key data: " + keyDataHex);
- } else {
- allKeyDataGenerated[keyDataHex] = true;
- testPassed("Generated unique key data of length: " + (keyData.byteLength * 8) + " bits");
- }
- });
- }
-
- return promise;
-}
-
-var lastPromise = Promise.resolve(null);
-
-kPossibleAlgorithms.forEach(function(algorithmName) {
- kPossibleExtractable.forEach(function(extractable) {
- kPossibleKeyUsages.forEach(function(keyUsages) {
- kPossibleKeyLengths.forEach(function(keyLengthBits) {
- lastPromise = lastPromise.then(runTest.bind(null, algorithmName, extractable, keyUsages, keyLengthBits));
- });
- });
- });
-});
-
-lastPromise.then(finishJSTest, failAndFinishJSTest);
-
-</script>
-
-</body>
-</html>
« no previous file with comments | « LayoutTests/crypto/aes-gcm-parseAlgorithm-failures-expected.txt ('k') | LayoutTests/crypto/aes-generateKey-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698