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