Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / webgl / instanceof-test.html
blob423ae33a0b11672a8c951964a8ba2be3eaacbd60
2 <!DOCTYPE html>
3 <html>
4 <head>
5 <meta charset="utf-8">
6 <title>WebGL instanceof test.</title>
7 <script src="../../../resources/js-test.js"></script>
8 <script src="resources/webgl-test.js"> </script>
9 <script src="resources/webgl-test-utils.js"> </script>
10 </head>
11 <body>
12 <canvas id="canvas" width="2" height="2" style="width: 40px; height: 40px;"></canvas>
13 <div id="description"></div>
14 <div id="console"></div>
15 <script id="vshader" type="x-shader/x-vertex">
16 attribute vec4 vPosition;
17 varying vec2 texCoord;
18 void main()
20 gl_Position = vPosition;
22 </script>
24 <script id="fshader" type="x-shader/x-fragment">
25 precision mediump float;
26 uniform vec4 color;
27 void main()
29 gl_FragColor = color;
31 </script>
32 <script>
33 var wtu = WebGLTestUtils;
34 description(document.title);
35 debug("Tests that instanceof works on WebGL objects.");
36 debug("");
37 var gl = create3DContext(document.getElementById("canvas"));
38 shouldBeTrue('gl instanceof WebGLRenderingContext');
39 shouldBeTrue('gl.createBuffer() instanceof WebGLBuffer');
40 shouldBeTrue('gl.createFramebuffer() instanceof WebGLFramebuffer');
41 shouldBeTrue('gl.createProgram() instanceof WebGLProgram');
42 shouldBeTrue('gl.createRenderbuffer() instanceof WebGLRenderbuffer');
43 shouldBeTrue('gl.createShader(gl.VERTEX_SHADER) instanceof WebGLShader');
44 shouldBeTrue('gl.createTexture() instanceof WebGLTexture');
46 var program = wtu.setupProgram(
47 gl,
48 [wtu.loadShaderFromScript(gl, 'vshader', gl.VERTEX_SHADER),
49 wtu.loadShaderFromScript(gl, 'fshader', gl.FRAGMENT_SHADER)],
50 ['vPosition'], [0]);
52 shouldBeTrue('gl.getUniformLocation(program, "color") instanceof WebGLUniformLocation');
53 shouldBeTrue('gl.getActiveAttrib(program, 0) instanceof WebGLActiveInfo');
54 shouldBeTrue('gl.getActiveUniform(program, 0) instanceof WebGLActiveInfo');
56 debug("");
57 debug("Tests that those WebGL objects can not be constructed through new operator");
58 debug("");
60 function shouldThrowWithNew(objectType, objectName)
62 try {
63 new objectType;
64 testFailed('new ' + objectName + ' did not throw');
65 } catch (e) {
66 testPassed('new ' + objectName + ' threw an error');
70 shouldThrowWithNew(window.WebGLRenderingContext, 'WebGLRenderingContext');
71 shouldThrowWithNew(window.WebGLActiveInfo, 'WebGLActiveInfo');
72 shouldThrowWithNew(window.WebGLBuffer, 'WebGLBuffer');
73 shouldThrowWithNew(window.WebGLFramebuffer, 'WebGLFramebuffer');
74 shouldThrowWithNew(window.WebGLProgram, 'WebGLProgram');
75 shouldThrowWithNew(window.WebGLRenderbuffer, 'WebGLRenderbuffer');
76 shouldThrowWithNew(window.WebGLShader, 'WebGLShader');
77 shouldThrowWithNew(window.WebGLTexture, 'WebGLTexture');
78 shouldThrowWithNew(window.WebGLUniformLocation, 'WebGLUniformLocation');
79 shouldThrowWithNew(window.WebGLShaderPrecisionFormat, 'WebGLShaderPrecisionFormat');
81 successfullyParsed = true;
82 </script>
84 </body>
85 </html>