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

Side by Side Diff: LayoutTests/crypto/crypto-random-values.html

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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
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 crypto.randomValues.");
11
12 if (!window.ArrayBuffer)
13 debug("This test requres ArrayBuffers to run!");
14
15 shouldBe("'crypto' in window", "true");
16 shouldBe("'getRandomValues' in window.crypto", "true");
17
18 try {
19 // FIXME: This test is flaky. If we ran this test every second since the
20 // beginning of the universe, on average, it would have failed
21 // 2^{-748} times.
22
23 var reference = new Uint8Array(100);
24 var sample = new Uint8Array(100);
25
26 crypto.getRandomValues(reference);
27 crypto.getRandomValues(sample);
28
29 var matchingBytes = 0;
30
31 for (var i = 0; i < reference.length; i++) {
32 if (reference[i] == sample[i])
33 matchingBytes++;
34 }
35
36 shouldBe("matchingBytes < 100", "true");
37 } catch(ex) {
38 debug(ex);
39 }
40
41 </script>
42 <script src="../fast/js/resources/js-test-post.js"></script>
43 </body>
44 </html>
45
46
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/crypto/crypto-random-values-expected.txt » ('j') | Source/bindings/v8/custom/V8CryptoCustom.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698