Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / crypto / random-values-limits.js
blob56e6af2505e56ae7d1ae5778a62287ed1e69d2ab
1 if (self.importScripts)
2     importScripts('../resources/js-test.js');
4 description("Tests the limits of crypto.randomValues.");
6 if (!self.ArrayBuffer)
7     debug("This test requres ArrayBuffers to run!");
9 shouldBe("'crypto' in self", "true");
10 shouldBe("'getRandomValues' in self.crypto", "true");
12 try {
13     var almostTooLargeArray = new Uint8Array(65536);
14     var tooLargeArray = new Uint8Array(65537);
16     shouldNotThrow("crypto.getRandomValues(almostTooLargeArray)");
17     shouldThrow("crypto.getRandomValues(tooLargeArray)");
18 } catch(ex) {
19     debug(ex);
22 finishJSTest();