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

Side by Side Diff: third_party/webgl/sdk/tests/conformance/misc/instanceof-test.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) 2011 The Chromium Authors. 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 instanceof test.</title>
11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
12 <script src="../../resources/js-test-pre.js"></script>
13 <script src="../resources/webgl-test.js"> </script>
14 <script src="../resources/webgl-test-utils.js"> </script>
15 </head>
16 <body>
17 <canvas id="canvas" width="2" height="2" style="width: 40px; height: 40px;"></ca nvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id="vshader" type="x-shader/x-vertex">
21 attribute vec4 vPosition;
22 varying vec2 texCoord;
23 void main()
24 {
25 gl_Position = vPosition;
26 }
27 </script>
28
29 <script id="fshader" type="x-shader/x-fragment">
30 precision mediump float;
31 uniform vec4 color;
32 void main()
33 {
34 gl_FragColor = color;
35 }
36 </script>
37 <script>
38 var wtu = WebGLTestUtils;
39 description(document.title);
40 debug("Tests that instanceof works on WebGL objects.");
41 debug("");
42 var gl = create3DContext(document.getElementById("canvas"));
43 shouldBeTrue('gl instanceof WebGLRenderingContext');
44 shouldBeTrue('gl.createBuffer() instanceof WebGLBuffer');
45 shouldBeTrue('gl.createFramebuffer() instanceof WebGLFramebuffer');
46 shouldBeTrue('gl.createProgram() instanceof WebGLProgram');
47 shouldBeTrue('gl.createRenderbuffer() instanceof WebGLRenderbuffer');
48 shouldBeTrue('gl.createShader(gl.VERTEX_SHADER) instanceof WebGLShader');
49 shouldBeTrue('gl.createTexture() instanceof WebGLTexture');
50
51 var program = wtu.setupProgram(
52 gl,
53 [wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
54 wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
55 ['vPosition'], [0]);
56
57 shouldBeTrue('gl.getUniformLocation(program, "color") instanceof WebGLUniformLoc ation');
58 shouldBeTrue('gl.getActiveAttrib(program, 0) instanceof WebGLActiveInfo');
59 shouldBeTrue('gl.getActiveUniform(program, 0) instanceof WebGLActiveInfo');
60
61 debug("");
62 debug("Tests that those WebGL objects can not be constructed through new operato r");
63 debug("");
64
65 function shouldThrowWithNew(objectType, objectName)
66 {
67 try {
68 new objectType;
69 testFailed('new ' + objectName + ' did not throw');
70 } catch (e) {
71 testPassed('new ' + objectName + ' threw an error');
72 }
73 }
74
75 shouldThrowWithNew(WebGLRenderingContext, 'WebGLRenderingContext');
76 shouldThrowWithNew(WebGLActiveInfo, 'WebGLActiveInfo');
77 shouldThrowWithNew(WebGLBuffer, 'WebGLBuffer');
78 shouldThrowWithNew(WebGLFramebuffer, 'WebGLFramebuffer');
79 shouldThrowWithNew(WebGLProgram, 'WebGLProgram');
80 shouldThrowWithNew(WebGLRenderbuffer, 'WebGLRenderbuffer');
81 shouldThrowWithNew(WebGLShader, 'WebGLShader');
82 shouldThrowWithNew(WebGLTexture, 'WebGLTexture');
83 shouldThrowWithNew(WebGLUniformLocation, 'WebGLUniformLocation');
84 shouldThrowWithNew(WebGLShaderPrecisionFormat, 'WebGLShaderPrecisionFormat');
85
86 successfullyParsed = true;
87 </script>
88 <script src="../../resources/js-test-post.js"></script>
89
90 </body>
91 </html>
92
93
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698