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

Unified Diff: LayoutTests/crypto/hmac-generateKey-parseAlgorithm-failures.html

Issue 215153005: [refactor] Split up generateKey.html into multiple files, and test errors directly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Re-upload with --similarity=20 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/hmac-generateKey-parseAlgorithm-failures.html
diff --git a/LayoutTests/crypto/aes-gcm-parseAlgorithm-failures.html b/LayoutTests/crypto/hmac-generateKey-parseAlgorithm-failures.html
similarity index 40%
copy from LayoutTests/crypto/aes-gcm-parseAlgorithm-failures.html
copy to LayoutTests/crypto/hmac-generateKey-parseAlgorithm-failures.html
index dd4e3b3120ccdbd95cfda458fb4ccfbc5740af40..fb5dc6b9b4f7d5736768580e907820259277160c 100644
--- a/LayoutTests/crypto/aes-gcm-parseAlgorithm-failures.html
+++ b/LayoutTests/crypto/hmac-generateKey-parseAlgorithm-failures.html
@@ -9,54 +9,54 @@
<div id="console"></div>
<script>
-description("Tests bad algorithm inputs for AES-GCM");
-
+description("Tests generateKey() with bad HMAC parameters.");
jsTestIsAsync = true;
-var keyData = hexStringToUint8Array("2b7e151628aed2a6abf7158809cf4f3c");
-var data = asciiToUint8Array("hello");
-var key = null;
+extractable = true;
+keyUsages = ['sign', 'verify'];
-Promise.resolve(null).then(function(result) {
- var usages = ['encrypt', 'decrypt'];
- var extractable = false;
- var algorithm = {name: 'aes-gcm'};
+Promise.resolve(null).then(function() {
+ return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: -3}, extractable , keyUsages);
+}).then(failAndFinishJSTest, function(result) {
+ error = result;
+ shouldBeNull("error");
- return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usages);
-}).then(function(result) {
- key = result;
+ return crypto.subtle.generateKey({name: 'hmac', hash: {name: ''}, length: 48}, extractable , keyUsages);
+}).then(failAndFinishJSTest, function(result) {
+ error = result;
+ shouldBeNull("error");
- return crypto.subtle.encrypt({name: 'AES-gcm'}, key, data);
+ return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: 5000000000}, extractable , keyUsages);
}).then(failAndFinishJSTest, function(result) {
error = result;
shouldBeNull("error");
- return crypto.subtle.encrypt({name: 'AES-gcm', iv: 3}, key, data);
+ return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: NaN}, extractable , keyUsages);
}).then(failAndFinishJSTest, function(result) {
error = result;
shouldBeNull("error");
- return crypto.subtle.encrypt({name: 'AES-gcm', iv: 'foo'}, key, data);
+ return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: Infinity}, extractable , keyUsages);
}).then(failAndFinishJSTest, function(result) {
error = result;
shouldBeNull("error");
- return crypto.subtle.encrypt({name: 'AeS-gcm', iv: new Uint8Array(16), additionalData: '5'}, key, data);
+ return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: -Infinity}, extractable , keyUsages);
}).then(failAndFinishJSTest, function(result) {
error = result;
shouldBeNull("error");
- return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), additionalData: new Uint8Array(1), tagLength: 'foo'}, key, data);
+ return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: crypto}, extractable , keyUsages);
}).then(failAndFinishJSTest, function(result) {
error = result;
shouldBeNull("error");
- return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), additionalData: new Uint8Array(1), tagLength: -1}, key, data);
+ return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: undefined}, extractable , keyUsages);
}).then(failAndFinishJSTest, function(result) {
error = result;
shouldBeNull("error");
- return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), additionalData: new Uint8Array(1), tagLength: 8000}, key, data);
+ return crypto.subtle.generateKey({name: 'hmac', hash: {name: 'sha-256'}, length: true}, extractable , keyUsages);
}).then(failAndFinishJSTest, function(result) {
error = result;
shouldBeNull("error");
« no previous file with comments | « LayoutTests/crypto/generateKey-expected.txt ('k') | LayoutTests/crypto/hmac-generateKey-parseAlgorithm-failures-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698