5 <script src=
"../../../resources/js-test.js"></script>
6 <script src=
"resources/webgl-test.js"></script>
7 <script src=
"resources/typed-array-test-cases.js"></script>
10 <div id=
"description"></div>
11 <div id=
"console"></div>
14 description("Verifies allocation of large array buffers");
16 var currentlyRunning
= '';
18 function running(str
) {
19 currentlyRunning
= str
;
22 function output(str
) {
27 testPassed(currentlyRunning
);
34 exc
= currentlyRunning
+ ': ' + str
;
36 exc
= currentlyRunning
;
40 function assertEq(prefix
, expected
, val
) {
41 if (expected
!= val
) {
42 var str
= prefix
+ ': expected ' + expected
+ ', got ' + val
;
47 function assert(prefix
, expected
) {
49 var str
= prefix
+ ': expected value / true';
54 function printSummary() {
56 debug("Test passed.");
63 function testConstructionOfHugeArray(type
, name
, sz
) {
67 // Construction of huge arrays must fail because byteLength is
69 array
= new type(3000000000);
70 testFailed("Construction of huge " + name
+ " should throw exception");
72 testPassed("Construction of huge " + name
+ " threw exception");
79 for (var i
= 0; i
< testCases
.length
; i
++) {
80 var testCase
= testCases
[i
];
81 running(testCase
.name
);
82 if (!(testCase
.name
in window
)) {
83 fail("does not exist");
86 var type
= window
[testCase
.name
];
87 var name
= testCase
.name
;
88 testConstructionOfHugeArray(type
, name
, testCase
.elementSizeInBytes
);
93 var successfullyParsed
= true;