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

Side by Side Diff: LayoutTests/crypto/exportKey-badParameters.html

Issue 214233002: [webcrypto] Split exportKey.html test into smaller files. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 unified diff | Download patch | Annotate | Revision Log
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 exportKey() given bad inputs.");
13
14 jsTestIsAsync = true;
15
16 // Not keys
17 shouldThrow("crypto.subtle.exportKey('raw', null)");
18 shouldThrow("crypto.subtle.exportKey('raw', 3)");
19
20 function importAesKey()
21 {
22 var keyData = new Uint8Array(16);
23 var usages = ['encrypt'];
24 var extractable = true;
25 var algorithm = {name: 'aes-cbc'};
26
27 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage s);
28 }
29
30 importAesKey().then(function(result) {
31 key = result;
32
33 // Invalid export format
34 return crypto.subtle.exportKey(3, key);
35 }).then(failAndFinishJSTest, function(result) {
36 error = result;
37 shouldBeNull("error");
38
39 // Invalid export format
40 return crypto.subtle.exportKey(null, key);
41 }).then(failAndFinishJSTest, function(result) {
42 error = result;
43 shouldBeNull("error");
44
45 // Invalid export format
46 return crypto.subtle.exportKey('invalid', key);
47 }).then(failAndFinishJSTest, function(result) {
48 error = result;
49 shouldBeNull("error");
50 }).then(finishJSTest, failAndFinishJSTest);
51
52 </script>
53
54 </body>
55 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/exportKey.html ('k') | LayoutTests/crypto/exportKey-badParameters-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698