3 <script src=
"../LayoutTests/fast/js/resources/js-test-pre.js"></script>
7 description("Test to verify that serial allocation and dereferencing of large canvases will succeed");
8 // This is a manual test because it runs too slow as a LayoutTest, especially for GPU tests with mesa.
10 // 32 canvases of 8k x 8k will consume 8GB of RAM.
11 // Garbage collection should kick-in to prevent OOM failures.
12 for (var i
= 0; i
< 32; i
++) {
13 var canvas
= document
.createElement('canvas');
16 // Draw to trigger lazy backing store allocation
17 var ctx
= canvas
.getContext('2d');
18 ctx
.fillStyle
= '#0f0';
19 ctx
.fillRect(0, 0, 1, 1);
20 // Verify that allocation succeeded by verifying that draw succeeded
21 var imageData
= ctx
.getImageData(0, 0, 1, 1);
22 var imgdata
= imageData
.data
;
23 shouldBe("imgdata[0]", "0");
24 shouldBe("imgdata[1]", "255");
25 shouldBe("imgdata[2]", "0");
28 <script src=
"../LayoutTests/fast/js/resources/js-test-post.js"></script>