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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/webgl/sdk/tests/conformance/misc/functions-returning-strings.html
===================================================================
--- third_party/webgl/sdk/tests/conformance/misc/functions-returning-strings.html (revision 0)
+++ third_party/webgl/sdk/tests/conformance/misc/functions-returning-strings.html (revision 0)
@@ -0,0 +1,101 @@
+<!--
+Copyright (c) 2012 Mozilla Foundation. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Tests</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas" width="2" height="2"> </canvas>
+<script>
+description("Test that functions returning strings really do return strings (and not e.g. null)");
+debug("");
+
+var validVertexShaderString =
+ "attribute vec4 aVertex; attribute vec4 aColor; varying vec4 vColor; void main() { vColor = aColor; gl_Position = aVertex; }";
+var validFragmentShaderString =
+ "precision mediump float; varying vec4 vColor; void main() { gl_FragColor = vColor; }";
+
+function shouldReturnString(_a)
+{
+ var exception;
+ var _av;
+ try {
+ _av = eval(_a);
+ } catch (e) {
+ exception = e;
+ }
+
+ if (exception)
+ testFailed(_a + ' should return a string. Threw exception ' + exception);
+ else if (typeof _av == "string")
+ testPassed(_a + ' returns a string');
+ else
+ testFailed(_a + ' should return a string. Returns: "' + _av + '"');
+}
+
+var gl = create3DContext(document.getElementById("canvas"));
+if (!gl) {
+ testFailed("context does not exist");
+} else {
+ var vs = gl.createShader(gl.VERTEX_SHADER);
+ shouldReturnString("gl.getShaderSource(vs)");
+ shouldReturnString("gl.getShaderInfoLog(vs)");
+ gl.shaderSource(vs, validVertexShaderString);
+ gl.compileShader(vs);
+ shouldReturnString("gl.getShaderSource(vs)");
+ shouldReturnString("gl.getShaderInfoLog(vs)");
+
+ var fs = gl.createShader(gl.FRAGMENT_SHADER);
+ shouldReturnString("gl.getShaderSource(fs)");
+ shouldReturnString("gl.getShaderInfoLog(fs)");
+ gl.shaderSource(fs, validFragmentShaderString);
+ gl.compileShader(fs);
+ shouldReturnString("gl.getShaderSource(fs)");
+ shouldReturnString("gl.getShaderInfoLog(fs)");
+
+ var prog = gl.createProgram();
+ shouldReturnString("gl.getProgramInfoLog(prog)");
+ gl.attachShader(prog, vs);
+ gl.attachShader(prog, fs);
+ gl.linkProgram(prog);
+ shouldReturnString("gl.getProgramInfoLog(prog)");
+
+ // Make sure different numbers of extensions doesn't result in
+ // different test output.
+ var exts = gl.getSupportedExtensions();
+ var allPassed = true;
+ for (i in exts) {
+ if (typeof i != "string") {
+ shouldReturnString("gl.getSupportedExtensions()[" + i + "]");
+ allPassed = false;
+ }
+ }
+ if (allPassed) {
+ testPassed('getSupportedExtensions() returns an array of strings');
+ }
+
+ shouldReturnString("gl.getParameter(gl.VENDOR)");
+ shouldReturnString("gl.getParameter(gl.RENDERER)");
+ shouldReturnString("gl.getParameter(gl.VERSION)");
+ shouldReturnString("gl.getParameter(gl.SHADING_LANGUAGE_VERSION)");
+}
+
+debug("");
+successfullyParsed = true;
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
Property changes on: third_party/webgl/sdk/tests/conformance/misc/functions-returning-strings.html
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698