| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
| 6 #include <GLES2/gl2ext.h> | 6 #include <GLES2/gl2ext.h> |
| 7 #include <GLES2/gl2extchromium.h> | 7 #include <GLES2/gl2extchromium.h> |
| 8 | 8 |
| 9 #include "gpu/command_buffer/service/context_group.h" | 9 #include "gpu/command_buffer/service/context_group.h" |
| 10 #include "gpu/command_buffer/tests/gl_manager.h" | 10 #include "gpu/command_buffer/tests/gl_manager.h" |
| 11 #include "gpu/command_buffer/tests/gl_test_utils.h" | 11 #include "gpu/command_buffer/tests/gl_test_utils.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 #define SHADER(Src) #Src | 15 #define SHADER(Src) #Src |
| 16 | 16 |
| 17 namespace gpu { | 17 namespace gpu { |
| 18 | 18 |
| 19 class GLProgramTest : public testing::Test { | 19 class GLProgramTest : public testing::Test { |
| 20 protected: | 20 protected: |
| 21 void SetUp() override { gl_.Initialize(GLManager::Options()); } | 21 void SetUp() override { gl_.Initialize(GLManager::Options()); } |
| 22 | 22 |
| 23 void TearDown() override { gl_.Destroy(); } | 23 void TearDown() override { gl_.Destroy(); } |
| 24 | |
| 25 GLManager gl_; | 24 GLManager gl_; |
| 26 }; | 25 }; |
| 27 | 26 |
| 28 class WebGLProgramTest : public GLProgramTest { | 27 class WebGLProgramTest : public GLProgramTest { |
| 29 protected: | 28 protected: |
| 30 void SetUp() override { | 29 void SetUp() override { |
| 31 GLManager::Options options; | 30 GLManager::Options options; |
| 32 options.webgl_version = 1; | 31 options.context_type = GLManager::CONTEXT_TYPE_WEBGL1; |
| 33 gl_.Initialize(options); | 32 gl_.Initialize(options); |
| 34 } | 33 } |
| 35 }; | 34 }; |
| 36 | 35 |
| 37 TEST_F(GLProgramTest, GetSetUniform) { | 36 TEST_F(GLProgramTest, GetSetUniform) { |
| 38 static const char* v_shader_str = SHADER( | 37 static const char* v_shader_str = SHADER( |
| 39 attribute vec4 a_vertex; | 38 attribute vec4 a_vertex; |
| 40 attribute vec3 a_normal; | 39 attribute vec3 a_normal; |
| 41 | 40 |
| 42 uniform mat4 u_modelViewProjMatrix; | 41 uniform mat4 u_modelViewProjMatrix; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 270 |
| 272 glLinkProgram(program); | 271 glLinkProgram(program); |
| 273 | 272 |
| 274 GLint linked = 0; | 273 GLint linked = 0; |
| 275 glGetProgramiv(program, GL_LINK_STATUS, &linked); | 274 glGetProgramiv(program, GL_LINK_STATUS, &linked); |
| 276 EXPECT_NE(0, linked); | 275 EXPECT_NE(0, linked); |
| 277 } | 276 } |
| 278 | 277 |
| 279 } // namespace gpu | 278 } // namespace gpu |
| 280 | 279 |
| OLD | NEW |