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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « conformance/more/conformance/constants.html ('k') | conformance/more/conformance/getContext.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: conformance/more/conformance/fuzzTheAPI.html
===================================================================
--- conformance/more/conformance/fuzzTheAPI.html (revision 0)
+++ conformance/more/conformance/fuzzTheAPI.html (revision 0)
@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<html><head>
+<meta charset="utf-8">
+<link rel="stylesheet" type="text/css" href="../unit.css" />
+<script type="application/x-javascript" src="../unit.js"></script>
+<script type="application/x-javascript" src="../util.js"></script>
+
+<script type="application/x-javascript">
+
+Tests.autorun = false;
+Tests.message = "This will fuzz the API with random inputs for a [long] while."
+
+
+function randomCall(testProgress, gl, m, arities) {
+ doTestNotify(m);
+ var argcs = {};
+ var foundArity = false;
+ if (arities == null) {
+ testProgress.textContent += " 500 random arity calls on " + m + "\n";
+ for (var i=0; i<50; i++) {
+ for (var j=0; j<10; j++) {
+ var args = generateRandomArgs(j);
+// doTestNotify(m + ": " + args.toSource());
+ try {
+ gl[m].apply(gl, args);
+ argcs[j] = true;
+ foundArity = true;
+ } catch (e) {
+ }
+ }
+ }
+ for (var j in argcs) {
+ testProgress.textContent += "200 arity " + j + " calls on " + m + "\n";
+ for (var i=0; i<200; i++) {
+ var args = generateRandomArgs(j);
+// doTestNotify(m + ": " + args.toSource());
+ try {
+ gl[m].apply(gl, args);
+ argcs[j] = true;
+ } catch (e) {
+ }
+ }
+ }
+ } else {
+ for (var k=0; k<arities.length; k++) {
+ var j = arities[k];
+ testProgress.textContent += "500 arity " + j + " calls on " + m + "\n";
+ for (var i=0; i<500; i++) {
+ var args = generateRandomArgs(j);
+// doTestNotify(m + ": " + args.toSource());
+ try {
+ gl[m].apply(gl, args);
+ } catch (e) {
+ }
+ }
+ }
+ }
+// doTestNotify(m+"--OK");
+}
+
+Tests.testGetGLWeb20 = function() {
+ var testProgress = document.getElementById('testProgress');
+ var funcnames = document.getElementById('funcnames').value.split(",");
+ var canvas = document.getElementById('glweb20');
+ var gl;
+ assertOk(function(){gl = canvas.getContext(GL_CONTEXT_ID);});
+ var funcs = [];
+ for (var i=0; i<funcnames.length; i++) {
+ var fn = funcnames[i];
+ fn = fn.replace(/^\s+|\s+$/g, '');
+ if (fn.length > 0)
+ funcs.push(fn);
+ }
+ if (funcs.length == 0) {
+ for (var m in gl)
+ try{if (typeof gl[m] == 'function')
+ funcs.push(m);}catch(e){}
+ }
+ var idx = 0;
+ var count = 0;
+ var limit = 1000;
+ var iv1;
+ var iv2;
+ iv1 = setInterval(function(){
+ if (idx >= funcs.length) {
+ iv2 = setInterval(function(){
+ if (count >= limit) {
+ clearInterval(iv2);
+ return false;
+ }
+ count++;
+ var f = Math.floor(Math.random() * funcs.length);
+ randomCall(testProgress, gl, funcs[f]);
+ }, 50);
+ clearInterval(iv1);
+ return false;
+ }
+ randomCall(testProgress, gl, funcs[idx]);
+ idx++;
+ }, 50);
+}
+
+</script>
+<style>canvas{ position:absolute; }</style>
+</head><body>
+ <canvas id="glweb20" width="16" height="16"></canvas>
+ <p>Optional: Enter a comma-separated list of functions to fuzz (leave blank for full API)</p>
+ <input type="text" size="40" id="funcnames" value="">
+ <pre id="testProgress"></pre>
+</body></html>
Property changes on: conformance/more/conformance/fuzzTheAPI.html
___________________________________________________________________
Added: svn:eol-style
+ LF
« 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