OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 GLManager gl_real_; | 43 GLManager gl_real_; |
44 GLManager gl_real_shared_; | 44 GLManager gl_real_shared_; |
45 GLManager gl1_; | 45 GLManager gl1_; |
46 GLManager gl2_; | 46 GLManager gl2_; |
47 }; | 47 }; |
48 | 48 |
49 namespace { | 49 namespace { |
50 | 50 |
| 51 #if !defined(OS_ANDROID) |
51 void SetupSimpleShader(const uint8* color) { | 52 void SetupSimpleShader(const uint8* color) { |
52 static const char* v_shader_str = SHADER( | 53 static const char* v_shader_str = SHADER( |
53 attribute vec4 a_Position; | 54 attribute vec4 a_Position; |
54 void main() | 55 void main() |
55 { | 56 { |
56 gl_Position = a_Position; | 57 gl_Position = a_Position; |
57 } | 58 } |
58 ); | 59 ); |
59 | 60 |
60 static const char* f_shader_str = SHADER( | 61 static const char* f_shader_str = SHADER( |
(...skipping 22 matching lines...) Expand all Loading... |
83 } | 84 } |
84 | 85 |
85 void TestDraw(int size) { | 86 void TestDraw(int size) { |
86 uint8 expected_clear[] = { 127, 0, 255, 0, }; | 87 uint8 expected_clear[] = { 127, 0, 255, 0, }; |
87 glClearColor(0.5f, 0.0f, 1.0f, 0.0f); | 88 glClearColor(0.5f, 0.0f, 1.0f, 0.0f); |
88 glClear(GL_COLOR_BUFFER_BIT); | 89 glClear(GL_COLOR_BUFFER_BIT); |
89 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, size, size, 1, expected_clear)); | 90 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, size, size, 1, expected_clear)); |
90 glDrawArrays(GL_TRIANGLES, 0, 6); | 91 glDrawArrays(GL_TRIANGLES, 0, 6); |
91 } | 92 } |
92 | 93 |
| 94 #endif // !defined(OS_ANDROID) |
| 95 |
93 } // anonymous namespace | 96 } // anonymous namespace |
94 | 97 |
95 // http://crbug.com/281565 | 98 // http://crbug.com/281565 |
96 #if !defined(OS_ANDROID) | 99 #if !defined(OS_ANDROID) |
97 TEST_F(GLVirtualContextsTest, Basic) { | 100 TEST_F(GLVirtualContextsTest, Basic) { |
98 struct TestInfo { | 101 struct TestInfo { |
99 int size; | 102 int size; |
100 uint8 color[4]; | 103 uint8 color[4]; |
101 GLManager* manager; | 104 GLManager* manager; |
102 }; | 105 }; |
(...skipping 30 matching lines...) Expand all Loading... |
133 const TestInfo& test = tests[ii]; | 136 const TestInfo& test = tests[ii]; |
134 GLManager* gl_manager = test.manager; | 137 GLManager* gl_manager = test.manager; |
135 gl_manager->MakeCurrent(); | 138 gl_manager->MakeCurrent(); |
136 GLTestHelper::CheckGLError("no errors", __LINE__); | 139 GLTestHelper::CheckGLError("no errors", __LINE__); |
137 } | 140 } |
138 } | 141 } |
139 #endif | 142 #endif |
140 | 143 |
141 } // namespace gpu | 144 } // namespace gpu |
142 | 145 |
OLD | NEW |