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

Side by Side Diff: conformance/more/conformance/fuzzTheAPI.html

Issue 41503006: Add ToT WebGL conformance tests : part 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 7 years, 1 month 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
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <!--
6
7 /*
8 ** Copyright (c) 2012 The Khronos Group Inc.
9 **
10 ** Permission is hereby granted, free of charge, to any person obtaining a
11 ** copy of this software and/or associated documentation files (the
12 ** "Materials"), to deal in the Materials without restriction, including
13 ** without limitation the rights to use, copy, modify, merge, publish,
14 ** distribute, sublicense, and/or sell copies of the Materials, and to
15 ** permit persons to whom the Materials are furnished to do so, subject to
16 ** the following conditions:
17 **
18 ** The above copyright notice and this permission notice shall be included
19 ** in all copies or substantial portions of the Materials.
20 **
21 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
28 */
29
30 -->
31 <link rel="stylesheet" type="text/css" href="../unit.css" />
32 <script type="application/x-javascript" src="../unit.js"></script>
33 <script type="application/x-javascript" src="../util.js"></script>
34
35 <script type="application/x-javascript">
36
37 Tests.autorun = false;
38 Tests.message = "This will fuzz the API with random inputs for a [long] while."
39
40
41 function randomCall(testProgress, gl, m, arities) {
42 doTestNotify(m);
43 var argcs = {};
44 var foundArity = false;
45 if (arities == null) {
46 testProgress.textContent += " 500 random arity calls on " + m + "\n";
47 for (var i=0; i<50; i++) {
48 for (var j=0; j<10; j++) {
49 var args = generateRandomArgs(j);
50 // doTestNotify(m + ": " + args.toSource());
51 try {
52 gl[m].apply(gl, args);
53 argcs[j] = true;
54 foundArity = true;
55 } catch (e) {
56 }
57 }
58 }
59 for (var j in argcs) {
60 testProgress.textContent += "200 arity " + j + " calls on " + m + "\ n";
61 for (var i=0; i<200; i++) {
62 var args = generateRandomArgs(j);
63 // doTestNotify(m + ": " + args.toSource());
64 try {
65 gl[m].apply(gl, args);
66 argcs[j] = true;
67 } catch (e) {
68 }
69 }
70 }
71 } else {
72 for (var k=0; k<arities.length; k++) {
73 var j = arities[k];
74 testProgress.textContent += "500 arity " + j + " calls on " + m + "\ n";
75 for (var i=0; i<500; i++) {
76 var args = generateRandomArgs(j);
77 // doTestNotify(m + ": " + args.toSource());
78 try {
79 gl[m].apply(gl, args);
80 } catch (e) {
81 }
82 }
83 }
84 }
85 // doTestNotify(m+"--OK");
86 }
87
88 Tests.testGetGLWeb20 = function() {
89 var testProgress = document.getElementById('testProgress');
90 var funcnames = document.getElementById('funcnames').value.split(",");
91 var canvas = document.getElementById('glweb20');
92 var gl;
93 assertOk(function(){gl = getGLContext(canvas);});
94 var funcs = [];
95 for (var i=0; i<funcnames.length; i++) {
96 var fn = funcnames[i];
97 fn = fn.replace(/^\s+|\s+$/g, '');
98 if (fn.length > 0)
99 funcs.push(fn);
100 }
101 if (funcs.length == 0) {
102 for (var m in gl)
103 try{if (typeof gl[m] == 'function')
104 funcs.push(m);}catch(e){}
105 }
106 var idx = 0;
107 var count = 0;
108 var limit = 1000;
109 var iv1;
110 var iv2;
111 iv1 = setInterval(function(){
112 if (idx >= funcs.length) {
113 iv2 = setInterval(function(){
114 if (count >= limit) {
115 clearInterval(iv2);
116 return false;
117 }
118 count++;
119 var f = Math.floor(Math.random() * funcs.length);
120 randomCall(testProgress, gl, funcs[f]);
121 }, 50);
122 clearInterval(iv1);
123 return false;
124 }
125 randomCall(testProgress, gl, funcs[idx]);
126 idx++;
127 }, 50);
128 }
129
130 </script>
131 <style>canvas{ position:absolute; }</style>
132 </head><body>
133 <canvas id="glweb20" width="16" height="16"></canvas>
134 <p>Optional: Enter a comma-separated list of functions to fuzz (leave blank fo r full API)</p>
135 <input type="text" size="40" id="funcnames" value="">
136 <pre id="testProgress"></pre>
137 </body></html>
OLDNEW
« no previous file with comments | « conformance/more/conformance/constants.html ('k') | conformance/more/conformance/getContext.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698