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

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

Issue 179353002: [webcrypto] Add the KeyAlgorithm interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase yet again (another conflict) Created 6 years, 10 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/encrypt-decrypt-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
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 // (1) Import the key 145 // (1) Import the key
146 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage s).then(function(result) { 146 return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usage s).then(function(result) {
147 key = result; 147 key = result;
148 148
149 // shouldBe() can only resolve variables in global context. 149 // shouldBe() can only resolve variables in global context.
150 tmpKey = key; 150 tmpKey = key;
151 shouldBe("tmpKey.type", "'secret'"); 151 shouldBe("tmpKey.type", "'secret'");
152 shouldBe("tmpKey.extractable", "false"); 152 shouldBe("tmpKey.extractable", "false");
153 shouldBe("tmpKey.algorithm.name", "'AES-CBC'"); 153 shouldBe("tmpKey.algorithm.name", "'AES-CBC'");
154 shouldBe("tmpKey.algorithm.length", (keyData.byteLength * 8).toString()) ;
154 shouldBe("tmpKey.usages.join(',')", "'decrypt,encrypt'"); 155 shouldBe("tmpKey.usages.join(',')", "'decrypt,encrypt'");
155 156
156 // (2) Encrypt. 157 // (2) Encrypt.
157 return crypto.subtle.encrypt(algorithm, key, hexStringToUint8Array(testC ase.plainText)); 158 return crypto.subtle.encrypt(algorithm, key, hexStringToUint8Array(testC ase.plainText));
158 }).then(function(result) { 159 }).then(function(result) {
159 bytesShouldMatchHexString("Encryption", testCase.cipherText, result); 160 bytesShouldMatchHexString("Encryption", testCase.cipherText, result);
160 161
161 // (3) Decrypt 162 // (3) Decrypt
162 return crypto.subtle.decrypt(algorithm, key, hexStringToUint8Array(testC ase.cipherText)); 163 return crypto.subtle.decrypt(algorithm, key, hexStringToUint8Array(testC ase.cipherText));
163 }).then(function(result) { 164 }).then(function(result) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 shouldThrow("crypto.subtle.encrypt({name: 'bogus'}, null, data)"); 349 shouldThrow("crypto.subtle.encrypt({name: 'bogus'}, null, data)");
349 } 350 }
350 351
351 addTask(importTestKeys().then(testNormalizationFailures)); 352 addTask(importTestKeys().then(testNormalizationFailures));
352 353
353 completeTestWhenAllTasksDone(); 354 completeTestWhenAllTasksDone();
354 355
355 </script> 356 </script>
356 357
357 </body> 358 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/crypto/encrypt-decrypt-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698