| 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 | 7 |
| 8 #include "gpu/command_buffer/tests/gl_manager.h" | 8 #include "gpu/command_buffer/tests/gl_manager.h" |
| 9 #include "gpu/command_buffer/tests/gl_test_utils.h" | 9 #include "gpu/command_buffer/tests/gl_test_utils.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 #define SHADER(Src) #Src | 13 #define SHADER(Src) #Src |
| 14 | 14 |
| 15 namespace gpu { | 15 namespace gpu { |
| 16 | 16 |
| 17 class GLProgramTest : public testing::Test { | 17 class GLProgramTest : public testing::Test { |
| 18 protected: | 18 protected: |
| 19 virtual void SetUp() { | 19 void SetUp() override { gl_.Initialize(GLManager::Options()); } |
| 20 gl_.Initialize(GLManager::Options()); | |
| 21 } | |
| 22 | 20 |
| 23 virtual void TearDown() { | 21 void TearDown() override { gl_.Destroy(); } |
| 24 gl_.Destroy(); | |
| 25 } | |
| 26 | 22 |
| 27 GLManager gl_; | 23 GLManager gl_; |
| 28 }; | 24 }; |
| 29 | 25 |
| 30 TEST_F(GLProgramTest, GetSetUniform) { | 26 TEST_F(GLProgramTest, GetSetUniform) { |
| 31 static const char* v_shader_str = SHADER( | 27 static const char* v_shader_str = SHADER( |
| 32 attribute vec4 a_vertex; | 28 attribute vec4 a_vertex; |
| 33 attribute vec3 a_normal; | 29 attribute vec3 a_normal; |
| 34 | 30 |
| 35 uniform mat4 u_modelViewProjMatrix; | 31 uniform mat4 u_modelViewProjMatrix; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 GLuint position_loc = glGetAttribLocation(program, "a_position"); | 153 GLuint position_loc = glGetAttribLocation(program, "a_position"); |
| 158 GLTestHelper::SetupUnitQuad(position_loc); | 154 GLTestHelper::SetupUnitQuad(position_loc); |
| 159 glDrawArrays(GL_TRIANGLES, 0, 6); | 155 glDrawArrays(GL_TRIANGLES, 0, 6); |
| 160 uint8 expected_color[] = { 0, 0, 255, 255, }; | 156 uint8 expected_color[] = { 0, 0, 255, 255, }; |
| 161 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color)); | 157 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_color)); |
| 162 GLTestHelper::CheckGLError("no errors", __LINE__); | 158 GLTestHelper::CheckGLError("no errors", __LINE__); |
| 163 } | 159 } |
| 164 | 160 |
| 165 } // namespace gpu | 161 } // namespace gpu |
| 166 | 162 |
| OLD | NEW |