Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: extra/out-of-memory.html

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « extra/offscreen-issue.html ('k') | extra/out-of-resources.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2 Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
7 "http://www.w3.org/TR/html4/loose.dtd">
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>WebGL Out Of Memory Test</title>
12 <link rel="stylesheet" href="../resources/js-test-style.css"/>
13 <script src="../resources/desktop-gl-constants.js" type="text/javascript"></scri pt>
14 <script src="../resources/js-test-pre.js"></script>
15 <script src="../conformance/resources/webgl-test.js"></script>
16 </head>
17 <body>
18 <div id="description"></div>
19 <div id="console"></div>
20 <canvas id="canvas" width="2" height="2"> </canvas>
21 <script>
22 debug("This tests WebGL running out of memory.");
23
24 debug("");
25 debug("Canvas.getContext");
26
27 var gl = create3DContext(document.getElementById("canvas"));
28 if (!gl) {
29 testFailed("context does not exist");
30 } else {
31 testPassed("context exists");
32
33 debug("");
34 debug("Allocating shaders.");
35
36 function makeBigShader() {
37 var lines = [];
38 var line = "// ";
39 for (var ii = 0; ii < 1024; ++ii) {
40 line += String.fromCharCode(48 + ii % 10);
41 }
42 for (var ii = 0; ii < 1024; ++ii) {
43 lines[ii] = line;
44 }
45 var oneMB = lines.join();
46 for (var ii = 0; ii < 64; ++ii) {
47 lines[ii] = oneMB;
48 }
49 return lines.join("\n");
50 }
51
52 var shaderSource = makeBigShader();
53 debug("created " + Math.floor(shaderSource.length / 1024 / 1024) + "MB shader" );
54
55 var intervalId;
56 var count = 0;
57
58 function makeShader() {
59 ++count;
60 debug ("creating shader #" + count + " mem = " + Math.floor(shaderSource.len gth * count / 1024 / 1024) + "MB");
61 var shader = gl.createShader(gl.VERTEX_SHADER);
62 if (shader == null) {
63 window.clearInterval(intervalId);
64 testPassed("createShader returns null"); // not sure this is a passing
65 finish();
66 } else {
67 gl.shaderSource(shader, shaderSource);
68 var err = gl.getError();
69 if (err != gl.NO_ERROR) {
70 window.clearInterval(intervalId);
71 assertMsg(err == gl.OUT_OF_MEMORY, "shaderSource returns OUT_OF_MEMORY") ;
72 finish();
73 }
74 }
75 }
76
77 intervalId = window.setInterval(makeShader, 1000/15);
78 }
79
80 function finish() {
81 debug("");
82 successfullyParsed = true;
83 }
84
85 </script>
86 <!-- <script src="../resources/js-test-post.js"></script> -->
87
88 <script>
89 </script>
90
91 </body>
92 </html>
OLDNEW
« no previous file with comments | « extra/offscreen-issue.html ('k') | extra/out-of-resources.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698