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

Side by Side Diff: LayoutTests/crypto/resources/random-values-limits.js

Issue 16820007: Expose crypto.getRandomValues() to workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 6 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
1 <!DOCTYPE html> 1 if (self.importScripts)
2 <html> 2 importScripts('../../fast/js/resources/js-test-pre.js');
3 <head> 3
4 <script src="../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description("Tests the limits of crypto.randomValues."); 4 description("Tests the limits of crypto.randomValues.");
11 5
12 if (!window.ArrayBuffer) 6 if (!self.ArrayBuffer)
13 debug("This test requres ArrayBuffers to run!"); 7 debug("This test requres ArrayBuffers to run!");
14 8
15 shouldBe("'crypto' in window", "true"); 9 shouldBe("'crypto' in self", "true");
16 shouldBe("'getRandomValues' in window.crypto", "true"); 10 shouldBe("'getRandomValues' in self.crypto", "true");
17 11
18 try { 12 try {
19 var almostTooLargeArray = new Uint8Array(65536); 13 var almostTooLargeArray = new Uint8Array(65536);
20 var tooLargeArray = new Uint8Array(65537); 14 var tooLargeArray = new Uint8Array(65537);
21 15
22 shouldNotThrow("crypto.getRandomValues(almostTooLargeArray)"); 16 shouldNotThrow("crypto.getRandomValues(almostTooLargeArray)");
23 shouldThrow("crypto.getRandomValues(tooLargeArray)"); 17 shouldThrow("crypto.getRandomValues(tooLargeArray)");
24 } catch(ex) { 18 } catch(ex) {
25 debug(ex); 19 debug(ex);
26 } 20 }
27 21
28 </script> 22 finishJSTest();
29 <script src="../fast/js/resources/js-test-post.js"></script>
30 </body>
31 </html>
32
33
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698