diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/canvas/test/webgl-conf/checkout/conformance/typedarrays/array-large-array-tests.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dom/canvas/test/webgl-conf/checkout/conformance/typedarrays/array-large-array-tests.html | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/typedarrays/array-large-array-tests.html b/dom/canvas/test/webgl-conf/checkout/conformance/typedarrays/array-large-array-tests.html new file mode 100644 index 0000000000..8af76136aa --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/typedarrays/array-large-array-tests.html @@ -0,0 +1,102 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<link rel="stylesheet" href="../../resources/js-test-style.css"/> +<script src="../../js/js-test-pre.js"></script> +<script src="../../js/tests/typed-array-test-cases.js"></script> +</head> +<body> +<div id="description"></div> +<div id="console"></div> + +<script> +"use strict"; + +description("Verifies allocation of large array buffers"); + +var currentlyRunning = ''; +var allPassed = true; +function running(str) { + currentlyRunning = str; +} + +function output(str) { + debug(str); +} + +function pass() { + testPassed(currentlyRunning); +} + +function fail(str) { + allPassed = false; + var exc; + if (str) + exc = currentlyRunning + ': ' + str; + else + exc = currentlyRunning; + testFailed(exc); +} + +function assertEq(prefix, expected, val) { + if (expected != val) { + var str = prefix + ': expected ' + expected + ', got ' + val; + throw str; + } +} + +function assert(prefix, expected) { + if (!expected) { + var str = prefix + ': expected value / true'; + throw str; + } +} + +function printSummary() { + if (allPassed) { + debug("Test passed."); + } else { + debug("TEST FAILED"); + } +} + + +function testConstructionOfHugeArray(type, name, sz) { + if (sz == 1) + return; + try { + // Construction of huge arrays must fail because byteLength is + // an unsigned long + array = new type(3000000000); + testFailed("Construction of huge " + name + " should throw exception"); + } catch (e) { + testPassed("Construction of huge " + name + " threw exception"); + } +} + +function runTests() { + allPassed = true; + + for (var i = 0; i < testCases.length; i++) { + var testCase = testCases[i]; + running(testCase.name); + if (!(testCase.name in window)) { + fail("does not exist"); + continue; + } + var type = window[testCase.name]; + var name = testCase.name; + testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes); + } +} + +runTests(); +var successfullyParsed = true; + +</script> +<script src="../../js/js-test-post.js"></script> + +</body> +</html> + |