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

Side by Side Diff: LayoutTests/crypto/encrypt-decrypt.html

Issue 39093002: [webcrypto] Add some more layouttests for crypto.subtle.digest() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/crypto/digest-expected.txt ('k') | LayoutTests/crypto/importKey.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../fast/js/resources/js-test-pre.js"></script> 4 <script src="../fast/js/resources/js-test-pre.js"></script>
5 <script src="resources/common.js"></script> 5 <script src="resources/common.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <p id="description"></p> 8 <p id="description"></p>
9 <div id="console"></div> 9 <div id="console"></div>
10 10
11 <script> 11 <script>
12 description("Tests cypto.subtle.encrypt and crypto.subtle.decrypt"); 12 description("Tests cypto.subtle.encrypt and crypto.subtle.decrypt");
13 13
14 jsTestIsAsync = true; 14 jsTestIsAsync = true;
15 15
16 importTestKeys().then(function(importedKeys) { 16 importTestKeys().then(function(importedKeys) {
17 keys = importedKeys; 17 keys = importedKeys;
18 18
19 data = asciiToArrayBuffer("hello"); 19 data = asciiToUint8Array("hello");
20 20
21 // --------------------------------------------------- 21 // ---------------------------------------------------
22 // AES-CBC normalization failures (AesCbcParams) 22 // AES-CBC normalization failures (AesCbcParams)
23 // --------------------------------------------------- 23 // ---------------------------------------------------
24 24
25 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: null}, keys.aesCbc, data)"); 25 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: null}, keys.aesCbc, data)");
26 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC'}, keys.aesCbc, data)"); 26 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC'}, keys.aesCbc, data)");
27 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: 3}, keys.aesCbc, da ta)"); 27 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: 3}, keys.aesCbc, da ta)");
28 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array[0]}, keys.aesCbc, data)"); 28 shouldThrow("crypto.subtle.encrypt({name: 'AES-CBC', iv: new Uint8Array[0]}, keys.aesCbc, data)");
29 29
30 // Try calling with the wrong key type. 30 // Try calling with the wrong key type.
31 aesCbc = {name: 'AES-CBC', iv: new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])}; 31 aesCbc = {name: 'AES-CBC', iv: new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])};
32 shouldThrow("crypto.subtle.encrypt(aesCbc, keys.hmacSha1, data)"); 32 shouldThrow("crypto.subtle.encrypt(aesCbc, keys.hmacSha1, data)");
33 33
34 // Key doesn't support encrypt. 34 // Key doesn't support encrypt.
35 shouldThrow("crypto.subtle.encrypt(aesCbc, keys.aesCbcJustDecrypt, data)"); 35 shouldThrow("crypto.subtle.encrypt(aesCbc, keys.aesCbcJustDecrypt, data)");
36 36
37 // If no key was specified AND the algorithm was bogus, should complain 37 // If no key was specified AND the algorithm was bogus, should complain
38 // about the missing key first. 38 // about the missing key first.
39 shouldThrow("crypto.subtle.encrypt({name: 'bogus'}, null, data)"); 39 shouldThrow("crypto.subtle.encrypt({name: 'bogus'}, null, data)");
40 }).then(finishJSTest, failAndFinishJSTest); 40 }).then(finishJSTest, failAndFinishJSTest);
41 41
42 </script> 42 </script>
43 43
44 <script src="../fast/js/resources/js-test-post.js"></script> 44 <script src="../fast/js/resources/js-test-post.js"></script>
45 </body> 45 </body>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/digest-expected.txt ('k') | LayoutTests/crypto/importKey.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698