Index: LayoutTests/crypto/resources/random-values-limits.js |
diff --git a/LayoutTests/crypto/resources/random-values-limits.js b/LayoutTests/crypto/resources/random-values-limits.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f78f9bf2917f2af022bfb2f5de4e5923901ca76e |
--- /dev/null |
+++ b/LayoutTests/crypto/resources/random-values-limits.js |
@@ -0,0 +1,23 @@ |
+if (self.importScripts) { |
+ importScripts('../../fast/js/resources/js-test-pre.js'); |
+} |
+ |
+description("Tests the limits of crypto.randomValues."); |
+ |
+if (!self.ArrayBuffer) |
+ debug("This test requres ArrayBuffers to run!"); |
+ |
+shouldBe("'crypto' in self", "true"); |
+shouldBe("'getRandomValues' in self.crypto", "true"); |
+ |
+try { |
+ var almostTooLargeArray = new Uint8Array(65536); |
+ var tooLargeArray = new Uint8Array(65537); |
+ |
+ shouldNotThrow("crypto.getRandomValues(almostTooLargeArray)"); |
+ shouldThrow("crypto.getRandomValues(tooLargeArray)"); |
+} catch(ex) { |
+ debug(ex); |
+} |
+ |
+finishJSTest(); |