OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file defines tests that implementations of GLImage should pass in order | 5 // This file defines tests that implementations of GLImage should pass in order |
6 // to be conformant. | 6 // to be conformant. |
7 | 7 |
8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 8 #ifndef UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 9 #define UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
10 | 10 |
11 #include <stdint.h> | 11 #include <stdint.h> |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 | 14 |
15 #include "base/strings/stringize_macros.h" | 15 #include "base/strings/stringize_macros.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/gfx/buffer_format_util.h" | 19 #include "ui/gfx/buffer_format_util.h" |
20 #include "ui/gfx/buffer_types.h" | 20 #include "ui/gfx/buffer_types.h" |
21 #include "ui/gl/gl_bindings.h" | 21 #include "ui/gl/gl_bindings.h" |
22 #include "ui/gl/gl_context.h" | 22 #include "ui/gl/gl_context.h" |
23 #include "ui/gl/gl_helper.h" | 23 #include "ui/gl/gl_helper.h" |
24 #include "ui/gl/gl_image.h" | 24 #include "ui/gl/gl_image.h" |
25 #include "ui/gl/gl_implementation.h" | 25 #include "ui/gl/gl_implementation.h" |
26 #include "ui/gl/gl_surface.h" | 26 #include "ui/gl/gl_surface.h" |
| 27 #include "ui/gl/init/gl_factory.h" |
27 #include "ui/gl/test/gl_image_test_support.h" | 28 #include "ui/gl/test/gl_image_test_support.h" |
28 #include "ui/gl/test/gl_test_helper.h" | 29 #include "ui/gl/test/gl_test_helper.h" |
29 | 30 |
30 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
31 #include "base/mac/mac_util.h" | 32 #include "base/mac/mac_util.h" |
32 #endif | 33 #endif |
33 | 34 |
34 namespace gl { | 35 namespace gl { |
35 namespace { | 36 namespace { |
36 | 37 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 119 } |
119 | 120 |
120 } // namespace | 121 } // namespace |
121 | 122 |
122 template <typename GLImageTestDelegate> | 123 template <typename GLImageTestDelegate> |
123 class GLImageTest : public testing::Test { | 124 class GLImageTest : public testing::Test { |
124 protected: | 125 protected: |
125 // Overridden from testing::Test: | 126 // Overridden from testing::Test: |
126 void SetUp() override { | 127 void SetUp() override { |
127 GLImageTestSupport::InitializeGL(); | 128 GLImageTestSupport::InitializeGL(); |
128 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); | 129 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); |
129 context_ = gfx::GLContext::CreateGLContext(nullptr, surface_.get(), | 130 context_ = gl::init::CreateGLContext(nullptr, surface_.get(), |
130 gfx::PreferIntegratedGpu); | 131 gfx::PreferIntegratedGpu); |
131 context_->MakeCurrent(surface_.get()); | 132 context_->MakeCurrent(surface_.get()); |
132 } | 133 } |
133 void TearDown() override { | 134 void TearDown() override { |
134 context_->ReleaseCurrent(surface_.get()); | 135 context_->ReleaseCurrent(surface_.get()); |
135 context_ = nullptr; | 136 context_ = nullptr; |
136 surface_ = nullptr; | 137 surface_ = nullptr; |
137 GLImageTestSupport::CleanupGL(); | 138 GLImageTestSupport::CleanupGL(); |
138 } | 139 } |
139 | 140 |
140 protected: | 141 protected: |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 image->Destroy(true /* have_context */); | 334 image->Destroy(true /* have_context */); |
334 } | 335 } |
335 | 336 |
336 // The GLImageCopyTest test case verifies that the GLImage implementation | 337 // The GLImageCopyTest test case verifies that the GLImage implementation |
337 // handles CopyTexImage correctly. | 338 // handles CopyTexImage correctly. |
338 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); | 339 REGISTER_TYPED_TEST_CASE_P(GLImageCopyTest, CopyTexImage); |
339 | 340 |
340 } // namespace gl | 341 } // namespace gl |
341 | 342 |
342 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ | 343 #endif // UI_GL_TEST_GL_IMAGE_TEST_TEMPLATE_H_ |
OLD | NEW |