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

Side by Side Diff: conformance/more/conformance/fuzzTheAPI.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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html><head>
3 <meta charset="utf-8">
4 <link rel="stylesheet" type="text/css" href="../unit.css" />
5 <script type="application/x-javascript" src="../unit.js"></script>
6 <script type="application/x-javascript" src="../util.js"></script>
7
8 <script type="application/x-javascript">
9
10 Tests.autorun = false;
11 Tests.message = "This will fuzz the API with random inputs for a [long] while."
12
13
14 function randomCall(testProgress, gl, m, arities) {
15 doTestNotify(m);
16 var argcs = {};
17 var foundArity = false;
18 if (arities == null) {
19 testProgress.textContent += " 500 random arity calls on " + m + "\n";
20 for (var i=0; i<50; i++) {
21 for (var j=0; j<10; j++) {
22 var args = generateRandomArgs(j);
23 // doTestNotify(m + ": " + args.toSource());
24 try {
25 gl[m].apply(gl, args);
26 argcs[j] = true;
27 foundArity = true;
28 } catch (e) {
29 }
30 }
31 }
32 for (var j in argcs) {
33 testProgress.textContent += "200 arity " + j + " calls on " + m + "\ n";
34 for (var i=0; i<200; i++) {
35 var args = generateRandomArgs(j);
36 // doTestNotify(m + ": " + args.toSource());
37 try {
38 gl[m].apply(gl, args);
39 argcs[j] = true;
40 } catch (e) {
41 }
42 }
43 }
44 } else {
45 for (var k=0; k<arities.length; k++) {
46 var j = arities[k];
47 testProgress.textContent += "500 arity " + j + " calls on " + m + "\ n";
48 for (var i=0; i<500; i++) {
49 var args = generateRandomArgs(j);
50 // doTestNotify(m + ": " + args.toSource());
51 try {
52 gl[m].apply(gl, args);
53 } catch (e) {
54 }
55 }
56 }
57 }
58 // doTestNotify(m+"--OK");
59 }
60
61 Tests.testGetGLWeb20 = function() {
62 var testProgress = document.getElementById('testProgress');
63 var funcnames = document.getElementById('funcnames').value.split(",");
64 var canvas = document.getElementById('glweb20');
65 var gl;
66 assertOk(function(){gl = canvas.getContext(GL_CONTEXT_ID);});
67 var funcs = [];
68 for (var i=0; i<funcnames.length; i++) {
69 var fn = funcnames[i];
70 fn = fn.replace(/^\s+|\s+$/g, '');
71 if (fn.length > 0)
72 funcs.push(fn);
73 }
74 if (funcs.length == 0) {
75 for (var m in gl)
76 try{if (typeof gl[m] == 'function')
77 funcs.push(m);}catch(e){}
78 }
79 var idx = 0;
80 var count = 0;
81 var limit = 1000;
82 var iv1;
83 var iv2;
84 iv1 = setInterval(function(){
85 if (idx >= funcs.length) {
86 iv2 = setInterval(function(){
87 if (count >= limit) {
88 clearInterval(iv2);
89 return false;
90 }
91 count++;
92 var f = Math.floor(Math.random() * funcs.length);
93 randomCall(testProgress, gl, funcs[f]);
94 }, 50);
95 clearInterval(iv1);
96 return false;
97 }
98 randomCall(testProgress, gl, funcs[idx]);
99 idx++;
100 }, 50);
101 }
102
103 </script>
104 <style>canvas{ position:absolute; }</style>
105 </head><body>
106 <canvas id="glweb20" width="16" height="16"></canvas>
107 <p>Optional: Enter a comma-separated list of functions to fuzz (leave blank fo r full API)</p>
108 <input type="text" size="40" id="funcnames" value="">
109 <pre id="testProgress"></pre>
110 </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