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

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

Issue 209853010: [ABANDONED] Enable V8 Promises (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../resources/js-test.js"></script> 4 <script src="../resources/js-test.js"></script>
5 <script src="resources/common.js"></script> 5 <script src="resources/common.js"></script>
6 <script src="resources/keys.js"></script> 6 <script src="resources/keys.js"></script>
7 </head> 7 </head>
8 <body> 8 <body>
9 <p id="description"></p> 9 <p id="description"></p>
10 <div id="console"></div> 10 <div id="console"></div>
11 11
12 <script> 12 <script>
13 description("Tests cypto.subtle.exportKey."); 13 description("Tests cypto.subtle.exportKey.");
14 14
15 jsTestIsAsync = true; 15 jsTestIsAsync = true;
16 16
17 addTask(importTestKeys().then(function(result) { 17 importTestKeys().then(function(result) {
18 keys = result; 18 keys = result;
19 19
20 // Invalid export formats. 20 // Invalid export formats.
21 shouldRejectPromiseWithNull("crypto.subtle.exportKey(3, keys.aesCbcJustDecry pt)"); 21 shouldRejectPromiseWithNull("crypto.subtle.exportKey(3, keys.aesCbcJustDecry pt)");
22 shouldRejectPromiseWithNull("crypto.subtle.exportKey(null, keys.aesCbcJustDe crypt)"); 22 shouldRejectPromiseWithNull("crypto.subtle.exportKey(null, keys.aesCbcJustDe crypt)");
23 shouldRejectPromiseWithNull("crypto.subtle.exportKey('invalid', keys.aesCbcJ ustDecrypt)"); 23 shouldRejectPromiseWithNull("crypto.subtle.exportKey('invalid', keys.aesCbcJ ustDecrypt)");
24 24
25 // Invalid keys 25 // Invalid keys
26 shouldThrow("crypto.subtle.exportKey('raw', null)"); 26 shouldThrow("crypto.subtle.exportKey('raw', null)");
27 shouldThrow("crypto.subtle.exportKey('raw', 3)"); 27 shouldThrow("crypto.subtle.exportKey('raw', 3)");
28 28
29 shouldBe("keys.aesCbcJustDecrypt.extractable", "false") 29 shouldBe("keys.aesCbcJustDecrypt.extractable", "false")
30 shouldRejectPromiseWithNull("crypto.subtle.exportKey('raw', keys.aesCbcJustD ecrypt)"); 30 shouldRejectPromiseWithNull("crypto.subtle.exportKey('raw', keys.aesCbcJustD ecrypt)");
31 31
32 return crypto.subtle.exportKey('raw', keys.aesCbc); 32 return crypto.subtle.exportKey('raw', keys.aesCbc);
33 }).then(function(result) { 33 }).then(function(result) {
34 bytesShouldMatchHexString("Key bytes", "3136206279746573206f66206b657921", r esult); 34 bytesShouldMatchHexString("Key bytes", "3136206279746573206f66206b657921", r esult);
35 35
36 return crypto.subtle.exportKey('spki', keys.rsaSsaSha1Public); 36 return crypto.subtle.exportKey('spki', keys.rsaSsaSha1Public);
37 }).then(function(result) { 37 }).then(function(result) {
38 bytesShouldMatchHexString("Key bytes", kKeyData.rsa1.spki, result); 38 bytesShouldMatchHexString("Key bytes", kKeyData.rsa1.spki, result);
39 })); 39 });
40 40
41 completeTestWhenAllTasksDone(); 41 completeTestWhenAllTasksDone();
42 42
43 </script> 43 </script>
44 44
45 </body> 45 </body>
46 </html> 46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698