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 #ifndef GL_GLEXT_PROTOTYPES |
| 6 #define GL_GLEXT_PROTOTYPES |
| 7 #endif |
| 8 |
5 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> |
6 | 11 |
| 12 #include "gpu/command_buffer/service/mailbox_manager.h" |
7 #include "gpu/command_buffer/tests/gl_manager.h" | 13 #include "gpu/command_buffer/tests/gl_manager.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/gfx/gl/gl_share_group.h" |
10 | 17 |
11 namespace gpu { | 18 namespace gpu { |
12 | 19 |
13 class GLTest : public testing::Test { | 20 class GLTest : public testing::Test { |
14 protected: | 21 protected: |
| 22 GLTest() : gl_(new gles2::MailboxManager, new gfx::GLShareGroup) { |
| 23 } |
| 24 |
15 virtual void SetUp() { | 25 virtual void SetUp() { |
16 gl_.Initialize(gfx::Size(4, 4)); | 26 gl_.Initialize(gfx::Size(4, 4)); |
17 } | 27 } |
18 | 28 |
19 virtual void TearDown() { | 29 virtual void TearDown() { |
20 gl_.Destroy(); | 30 gl_.Destroy(); |
21 } | 31 } |
22 | 32 |
23 GLManager gl_; | 33 GLManager gl_; |
24 }; | 34 }; |
25 | 35 |
26 // Test that GL is at least minimally working. | 36 // Test that GL is at least minimally working. |
27 TEST_F(GLTest, Basic) { | 37 TEST_F(GLTest, Basic) { |
28 glClearColor(0.0f, 1.0f, 0.0f, 1.0f); | 38 glClearColor(0.0f, 1.0f, 0.0f, 1.0f); |
29 glClear(GL_COLOR_BUFFER_BIT); | 39 glClear(GL_COLOR_BUFFER_BIT); |
30 uint8 pixels[4] = { 0, }; | 40 uint8 pixels[4] = { 0, }; |
31 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 41 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
32 EXPECT_EQ(0u, pixels[0]); | 42 EXPECT_EQ(0u, pixels[0]); |
33 EXPECT_EQ(255u, pixels[1]); | 43 EXPECT_EQ(255u, pixels[1]); |
34 EXPECT_EQ(0u, pixels[2]); | 44 EXPECT_EQ(0u, pixels[2]); |
35 EXPECT_EQ(255u, pixels[3]); | 45 EXPECT_EQ(255u, pixels[3]); |
36 } | 46 } |
37 | 47 |
38 } // namespace gpu | 48 } // namespace gpu |
39 | 49 |
OLD | NEW |