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 | 13 |
14 #define SHADER(Src) #Src | 14 #define SHADER(Src) #Src |
15 | 15 |
16 namespace gpu { | 16 namespace gpu { |
17 | 17 |
18 class GLVirtualContextsTest : public testing::Test { | 18 class GLVirtualContextsTest : public testing::Test { |
19 protected: | 19 protected: |
20 static const int kSize0 = 4; | 20 static const int kSize0 = 4; |
21 static const int kSize1 = 8; | 21 static const int kSize1 = 8; |
22 static const int kSize2 = 16; | 22 static const int kSize2 = 16; |
23 | 23 |
24 static const GLfloat kFloatRed[4]; | 24 static const GLfloat kFloatRed[4]; |
25 static const GLfloat kFloatGreen[4]; | 25 static const GLfloat kFloatGreen[4]; |
26 static const uint8 kExpectedRed[4]; | 26 static const uint8 kExpectedRed[4]; |
27 static const uint8 kExpectedGreen[4]; | 27 static const uint8 kExpectedGreen[4]; |
28 | 28 |
29 virtual void SetUp() { | 29 void SetUp() override { |
30 GLManager::Options options; | 30 GLManager::Options options; |
31 options.size = gfx::Size(kSize0, kSize0); | 31 options.size = gfx::Size(kSize0, kSize0); |
32 gl_real_.Initialize(options); | 32 gl_real_.Initialize(options); |
33 gl_real_shared_.Initialize(options); | 33 gl_real_shared_.Initialize(options); |
34 options.virtual_manager = &gl_real_shared_; | 34 options.virtual_manager = &gl_real_shared_; |
35 options.size = gfx::Size(kSize1, kSize1); | 35 options.size = gfx::Size(kSize1, kSize1); |
36 gl1_.Initialize(options); | 36 gl1_.Initialize(options); |
37 options.size = gfx::Size(kSize2, kSize2); | 37 options.size = gfx::Size(kSize2, kSize2); |
38 gl2_.Initialize(options); | 38 gl2_.Initialize(options); |
39 } | 39 } |
40 | 40 |
41 virtual void TearDown() { | 41 void TearDown() override { |
42 gl1_.Destroy(); | 42 gl1_.Destroy(); |
43 gl2_.Destroy(); | 43 gl2_.Destroy(); |
44 gl_real_shared_.Destroy(); | 44 gl_real_shared_.Destroy(); |
45 gl_real_.Destroy(); | 45 gl_real_.Destroy(); |
46 } | 46 } |
47 | 47 |
48 GLuint SetupColoredVertexProgram() { | 48 GLuint SetupColoredVertexProgram() { |
49 static const char* v_shader_str = SHADER( | 49 static const char* v_shader_str = SHADER( |
50 attribute vec4 a_position; | 50 attribute vec4 a_position; |
51 attribute vec4 a_color; | 51 attribute vec4 a_color; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 glDrawArrays(GL_TRIANGLES, 0, 6); | 295 glDrawArrays(GL_TRIANGLES, 0, 6); |
296 EXPECT_TRUE( | 296 EXPECT_TRUE( |
297 GLTestHelper::CheckPixels(0, 0, kSize2, kSize2, 0, kExpectedGreen)); | 297 GLTestHelper::CheckPixels(0, 0, kSize2, kSize2, 0, kExpectedGreen)); |
298 glFinish(); | 298 glFinish(); |
299 | 299 |
300 GLTestHelper::CheckGLError("no errors", __LINE__); | 300 GLTestHelper::CheckGLError("no errors", __LINE__); |
301 } | 301 } |
302 | 302 |
303 } // namespace gpu | 303 } // namespace gpu |
304 | 304 |
OLD | NEW |