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

Side by Side Diff: LayoutTests/crypto/subtle/aes-gcm-parseAlgorithm-failures.html

Issue 861763002: [WebCrypto] Normalize name of WebCrypto failure layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script src="resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10
11 <script>
12 description("Tests bad algorithm inputs for AES-GCM");
13
14 jsTestIsAsync = true;
15
16 var keyData = hexStringToUint8Array("2b7e151628aed2a6abf7158809cf4f3c");
17 var data = asciiToUint8Array("hello");
18 var key = null;
19
20 Promise.resolve(null).then(function(result) {
21 var usages = ['encrypt', 'decrypt'];
22 var extractable = false;
23 var algorithm = {name: 'aes-gcm'};
24
25 debug('\nImporting AES-GCM key...');
26 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage s);
27 }).then(function(result) {
28 key = result;
29
30 debug('\nencrypt() without iv...');
31 return crypto.subtle.encrypt({name: 'AES-gcm'}, key, data);
32 }).then(failAndFinishJSTest, function(result) {
33 logError(result);
34
35 debug('\nencrypt() with iv that is a number...');
36 return crypto.subtle.encrypt({name: 'AES-gcm', iv: 3}, key, data);
37 }).then(failAndFinishJSTest, function(result) {
38 logError(result);
39
40 debug('\nencrypt() with iv that is a string...');
41 return crypto.subtle.encrypt({name: 'AES-gcm', iv: 'foo'}, key, data);
42 }).then(failAndFinishJSTest, function(result) {
43 logError(result);
44
45 debug('\nencrypt() with additionalData that is a string...');
46 return crypto.subtle.encrypt({name: 'AeS-gcm', iv: new Uint8Array(16), addit ionalData: '5'}, key, data);
47 }).then(failAndFinishJSTest, function(result) {
48 logError(result);
49
50 debug('\nencrypt() with tagLength that is a string...');
51 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit ionalData: new Uint8Array(1), tagLength: 'foo'}, key, data);
52 }).then(failAndFinishJSTest, function(result) {
53 logError(result);
54
55 debug('\nencrypt() with negative tagLength...');
56 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit ionalData: new Uint8Array(1), tagLength: -1}, key, data);
57 }).then(failAndFinishJSTest, function(result) {
58 logError(result);
59
60 debug('\nencrypt() with tagLength larger than an octet...');
61 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit ionalData: new Uint8Array(1), tagLength: 8000}, key, data);
62 }).then(failAndFinishJSTest, function(result) {
63 logError(result);
64
65 debug('\nencrypt() with tagLength that is 0...');
66 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit ionalData: new Uint8Array(1), tagLength: 0}, key, data);
67 }).then(failAndFinishJSTest, function(result) {
68 logError(result);
69
70 debug('\nencrypt() with tagLength that is 130...');
71 return crypto.subtle.encrypt({name: 'AES-gcm', iv: new Uint8Array(16), addit ionalData: new Uint8Array(1), tagLength: 130}, key, data);
72 }).then(failAndFinishJSTest, function(result) {
73 logError(result);
74 }).then(finishJSTest, failAndFinishJSTest);
75
76 </script>
77
78 </body>
79 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698