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

Side by Side Diff: LayoutTests/crypto/digest-failures.html

Issue 222003006: [webcrypto] Don't throw any extra WebIDL exceptions from WebCrypto methods. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 8 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 | « no previous file | LayoutTests/crypto/digest-failures-expected.txt » ('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="../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 </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 incorrect calls to crypto.subtle.digest()"); 12 description("Tests incorrect calls to crypto.subtle.digest()");
13 13
14 jsTestIsAsync = true; 14 jsTestIsAsync = true;
15 15
16 // Pass invalid data to digest() 16 // Called with too few parameters.
17 shouldThrow("crypto.subtle.digest({name: 'sha-1'})"); 17 shouldThrow("crypto.subtle.digest({name: 'sha-1'})");
18 shouldThrow("crypto.subtle.digest({name: 'sha-1'}, null)");
19 shouldThrow("crypto.subtle.digest({name: 'sha-1'}, 10)");
20
21 // Pass invalid algorithmIdentifiers to digest()
22 data = new Uint8Array([0]);
23 shouldThrow("crypto.subtle.digest(null, data)");
24 18
25 Promise.resolve(null).then(function(result) { 19 Promise.resolve(null).then(function(result) {
20 // "null" is not a valid data argument.
21 return crypto.subtle.digest({name: 'sha-1'}, null);
22 }).then(failAndFinishJSTest, function(result) {
23 error = result;
24 shouldBeNull("error");
25
26 // 10 is not a valid data argument.
27 return crypto.subtle.digest({name: 'sha-1'}, 10);
28 }).then(failAndFinishJSTest, function(result) {
29 error = result;
30 shouldBeNull("error");
31
32 // null is not a valid algorithm argument.
33 data = new Uint8Array([0]);
34 return crypto.subtle.digest(null, data);
35 }).then(failAndFinishJSTest, function(result) {
36 error = result;
37 shouldBeNull("error");
38
26 // "sha" is not a recognized algorithm name 39 // "sha" is not a recognized algorithm name
27 return crypto.subtle.digest({name: 'sha'}, data); 40 return crypto.subtle.digest({name: 'sha'}, data);
28 }).then(failAndFinishJSTest, function(result) { 41 }).then(failAndFinishJSTest, function(result) {
29 error = result; 42 error = result;
30 shouldBeNull("error"); 43 shouldBeNull("error");
31 44
32 // Algorithm lacks a name. 45 // Algorithm lacks a name.
33 return crypto.subtle.digest({}, data); 46 return crypto.subtle.digest({}, data);
34 }).then(failAndFinishJSTest, function(result) { 47 }).then(failAndFinishJSTest, function(result) {
35 error = result; 48 error = result;
36 shouldBeNull("error"); 49 shouldBeNull("error");
37 50
38 }).then(finishJSTest, failAndFinishJSTest); 51 }).then(finishJSTest, failAndFinishJSTest);
39 52
40 </script> 53 </script>
41 54
42 </body> 55 </body>
43 </html> 56 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/crypto/digest-failures-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698