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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/misc/functions-returning-strings.html

Issue 9373009: Check in webgl conformance tests r16844 from khronos. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 10 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 <!--
2 Copyright (c) 2012 Mozilla Foundation. 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>
7 <html>
8 <head>
9 <meta charset="utf-8">
10 <title>WebGL Conformance Tests</title>
11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
12 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></s cript>
13 <script src="../../resources/js-test-pre.js"></script>
14 <script src="../resources/webgl-test.js"></script>
15 </head>
16 <body>
17 <div id="description"></div>
18 <div id="console"></div>
19 <canvas id="canvas" width="2" height="2"> </canvas>
20 <script>
21 description("Test that functions returning strings really do return strings (and not e.g. null)");
22 debug("");
23
24 var validVertexShaderString =
25 "attribute vec4 aVertex; attribute vec4 aColor; varying vec4 vColor; void main () { vColor = aColor; gl_Position = aVertex; }";
26 var validFragmentShaderString =
27 "precision mediump float; varying vec4 vColor; void main() { gl_FragColor = vC olor; }";
28
29 function shouldReturnString(_a)
30 {
31 var exception;
32 var _av;
33 try {
34 _av = eval(_a);
35 } catch (e) {
36 exception = e;
37 }
38
39 if (exception)
40 testFailed(_a + ' should return a string. Threw exception ' + exception);
41 else if (typeof _av == "string")
42 testPassed(_a + ' returns a string');
43 else
44 testFailed(_a + ' should return a string. Returns: "' + _av + '"');
45 }
46
47 var gl = create3DContext(document.getElementById("canvas"));
48 if (!gl) {
49 testFailed("context does not exist");
50 } else {
51 var vs = gl.createShader(gl.VERTEX_SHADER);
52 shouldReturnString("gl.getShaderSource(vs)");
53 shouldReturnString("gl.getShaderInfoLog(vs)");
54 gl.shaderSource(vs, validVertexShaderString);
55 gl.compileShader(vs);
56 shouldReturnString("gl.getShaderSource(vs)");
57 shouldReturnString("gl.getShaderInfoLog(vs)");
58
59 var fs = gl.createShader(gl.FRAGMENT_SHADER);
60 shouldReturnString("gl.getShaderSource(fs)");
61 shouldReturnString("gl.getShaderInfoLog(fs)");
62 gl.shaderSource(fs, validFragmentShaderString);
63 gl.compileShader(fs);
64 shouldReturnString("gl.getShaderSource(fs)");
65 shouldReturnString("gl.getShaderInfoLog(fs)");
66
67 var prog = gl.createProgram();
68 shouldReturnString("gl.getProgramInfoLog(prog)");
69 gl.attachShader(prog, vs);
70 gl.attachShader(prog, fs);
71 gl.linkProgram(prog);
72 shouldReturnString("gl.getProgramInfoLog(prog)");
73
74 // Make sure different numbers of extensions doesn't result in
75 // different test output.
76 var exts = gl.getSupportedExtensions();
77 var allPassed = true;
78 for (i in exts) {
79 if (typeof i != "string") {
80 shouldReturnString("gl.getSupportedExtensions()[" + i + "]");
81 allPassed = false;
82 }
83 }
84 if (allPassed) {
85 testPassed('getSupportedExtensions() returns an array of strings');
86 }
87
88 shouldReturnString("gl.getParameter(gl.VENDOR)");
89 shouldReturnString("gl.getParameter(gl.RENDERER)");
90 shouldReturnString("gl.getParameter(gl.VERSION)");
91 shouldReturnString("gl.getParameter(gl.SHADING_LANGUAGE_VERSION)");
92 }
93
94 debug("");
95 successfullyParsed = true;
96
97 </script>
98 <script src="../../resources/js-test-post.js"></script>
99
100 </body>
101 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698