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

Side by Side Diff: conformance/more/conformance/quickCheckAPIBadArgs.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 <script type="application/x-javascript" src="quickCheckAPI.js"></script>
8
9 <script type="application/x-javascript">
10
11 // Test that all GL functions specified in ArgGenerators fail
12 // when called with randomly generated invalid arguments
13 // Works only on tests with checkArgValidity defined
14 Tests.testInvalidArgs = function() {
15 var randomTestCount = 100;
16 for (var name in ArgGenerators) {
17 try {
18 if (!GL[name])
19 throw (new Error(name + " is missing from the WebGL context"));
20 var argGen = ArgGenerators[name];
21 var alreadyTriedArgs = {};
22 if (!argGen.generate || !argGen.checkArgValidity) continue;
23 // test each GL function with randomTestCount randomly generated valid arg s
24 argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
25 var mutatedArgs;
26 var foundArgs = false;
27 for (var j=0; j<100; j++) {
28 mutatedArgs = mutateArgs(args);
29 var validArgs = false;
30 try {
31 validArgs = gen.checkArgValidity.apply(gen, mutatedArgs);
32 } catch(e) {}
33 if (!validArgs) {
34 if (gen.noAlreadyTriedCheck) {
35 foundArgs = true;
36 break; // found new invalid args
37 }
38 var src = Object.toSource(mutatedArgs);
39 if (!alreadyTriedArgs[src]) {
40 alreadyTriedArgs[src] = true;
41 foundArgs = true;
42 break; // found new invalid args
43 }
44 }
45 }
46 if (!foundArgs)
47 return true;
48 var ok = false;
49 var rv;
50 // assert that GL function fails when called with invalid args
51 assertFail("This should fail: "+name+"("+mutatedArgs.map(function(a){ret urn Object.toSource(a)}).join(",")+")",
52 function(){
53 GL.getError(); // clear off existing error
54 rv = GL[name].apply(GL, mutatedArgs);
55 throwError(GL, name);
56 ok = true;
57 });
58 // if we need to cleanup the return value, do it here
59 // e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() abov e
60 if (gen.returnValueCleanup && rv != null) {
61 assertOk("Cleaning up return value after "+name+"("+mutatedArgs.map(fu nction(a){return Object.toSource(a)}).join(",")+")",
62 function() { gen.returnValueCleanup(rv); });
63 }
64 GL.getError();
65 return !ok;
66 }, argGen.testCount || randomTestCount);
67 } catch(e) {
68 testFailed(name, e.name, formatError(e));
69 }
70 }
71 }
72
73 </script>
74 <style>canvas{position:absolute;}</style>
75 </head><body>
76 </body></html>
OLDNEW
« no previous file with comments | « conformance/more/conformance/quickCheckAPI-S_V.html ('k') | conformance/more/conformance/webGLArrays.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698