OLD | NEW |
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 |
(...skipping 16 matching lines...) Expand all Loading... |
27 debug("SHA1 of []"); | 27 debug("SHA1 of []"); |
28 return crypto.subtle.digest({name: 'sha-1'}, new Uint8Array([])); | 28 return crypto.subtle.digest({name: 'sha-1'}, new Uint8Array([])); |
29 }).then(function(result) { | 29 }).then(function(result) { |
30 printAcceptedResult(result); | 30 printAcceptedResult(result); |
31 | 31 |
32 debug("SHA1 of [0x0]") | 32 debug("SHA1 of [0x0]") |
33 return crypto.subtle.digest({name: 'sha-1'}, new Uint8Array([0])); | 33 return crypto.subtle.digest({name: 'sha-1'}, new Uint8Array([0])); |
34 }).then(function(result) { | 34 }).then(function(result) { |
35 printAcceptedResult(result); | 35 printAcceptedResult(result); |
36 | 36 |
37 debug("SHA-256 rejects (dummy implementation)"); | |
38 return crypto.subtle.digest({name: 'sha-256'}, new Uint8Array([])); | |
39 | |
40 }).then(undefined, function(result) { | |
41 printRejectedResult(result); | |
42 | |
43 debug("Error (dummy implementation rejects this input)"); | |
44 var data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); | |
45 return crypto.subtle.digest({name: 'sha-1'}, data); | |
46 }).then(undefined, function(result) { | |
47 printRejectedResult(result); | |
48 | |
49 // Pass invalid data to digeset() | 37 // Pass invalid data to digeset() |
50 shouldThrow("crypto.subtle.digest({name: 'sha-1'})"); | 38 shouldThrow("crypto.subtle.digest({name: 'sha-1'})"); |
51 shouldThrow("crypto.subtle.digest({name: 'sha-1'}, null)"); | 39 shouldThrow("crypto.subtle.digest({name: 'sha-1'}, null)"); |
52 shouldThrow("crypto.subtle.digest({name: 'sha-1'}, 10)"); | 40 shouldThrow("crypto.subtle.digest({name: 'sha-1'}, 10)"); |
53 | 41 |
54 // Pass invalid algorithmIdentifiers to digest() | 42 // Pass invalid algorithmIdentifiers to digest() |
55 data = new Uint8Array([0]); | 43 data = new Uint8Array([0]); |
56 shouldThrow("crypto.subtle.digest({name: 'sha'}, data)"); | 44 shouldThrow("crypto.subtle.digest({name: 'sha'}, data)"); |
57 shouldThrow("crypto.subtle.digest(null, data)"); | 45 shouldThrow("crypto.subtle.digest(null, data)"); |
58 shouldThrow("crypto.subtle.digest({}, data)"); | 46 shouldThrow("crypto.subtle.digest({}, data)"); |
59 }).then(finishJSTest, failAndFinishJSTest); | 47 }).then(finishJSTest, failAndFinishJSTest); |
60 | 48 |
61 </script> | 49 </script> |
62 | 50 |
63 <script src="../fast/js/resources/js-test-post.js"></script> | 51 <script src="../fast/js/resources/js-test-post.js"></script> |
64 </body> | 52 </body> |
65 </html> | 53 </html> |
OLD | NEW |