| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "gpu/command_buffer/client/gles2_implementation.h" | 13 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 14 #include "gpu/command_buffer/client/shared_memory_limits.h" | 14 #include "gpu/command_buffer/client/shared_memory_limits.h" |
| 15 #include "gpu/ipc/common/surface_handle.h" |
| 15 #include "gpu/ipc/gl_in_process_context.h" | 16 #include "gpu/ipc/gl_in_process_context.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 class ContextTestBase : public testing::Test { | 22 class ContextTestBase : public testing::Test { |
| 22 public: | 23 public: |
| 23 void SetUp() override { | 24 void SetUp() override { |
| 24 gpu::gles2::ContextCreationAttribHelper attributes; | 25 gpu::gles2::ContextCreationAttribHelper attributes; |
| 25 attributes.alpha_size = 8; | 26 attributes.alpha_size = 8; |
| 26 attributes.depth_size = 24; | 27 attributes.depth_size = 24; |
| 27 attributes.red_size = 8; | 28 attributes.red_size = 8; |
| 28 attributes.green_size = 8; | 29 attributes.green_size = 8; |
| 29 attributes.blue_size = 8; | 30 attributes.blue_size = 8; |
| 30 attributes.stencil_size = 8; | 31 attributes.stencil_size = 8; |
| 31 attributes.samples = 4; | 32 attributes.samples = 4; |
| 32 attributes.sample_buffers = 1; | 33 attributes.sample_buffers = 1; |
| 33 attributes.bind_generates_resource = false; | 34 attributes.bind_generates_resource = false; |
| 34 | 35 |
| 35 context_.reset(gpu::GLInProcessContext::Create( | 36 context_.reset( |
| 36 nullptr, /* service */ | 37 gpu::GLInProcessContext::Create(nullptr, /* service */ |
| 37 nullptr, /* surface */ | 38 nullptr, /* surface */ |
| 38 true, /* offscreen */ | 39 true, /* offscreen */ |
| 39 gfx::kNullAcceleratedWidget, /* window */ | 40 gpu::kNullSurfaceHandle, /* window */ |
| 40 nullptr, /* share_context */ | 41 nullptr, /* share_context */ |
| 41 attributes, gpu::SharedMemoryLimits(), | 42 attributes, gpu::SharedMemoryLimits(), |
| 42 nullptr, /* gpu_memory_buffer_manager */ | 43 nullptr, /* gpu_memory_buffer_manager */ |
| 43 nullptr, /* image_factory */ | 44 nullptr, /* image_factory */ |
| 44 base::ThreadTaskRunnerHandle::Get())); | 45 base::ThreadTaskRunnerHandle::Get())); |
| 45 gl_ = context_->GetImplementation(); | 46 gl_ = context_->GetImplementation(); |
| 46 context_support_ = context_->GetImplementation(); | 47 context_support_ = context_->GetImplementation(); |
| 47 } | 48 } |
| 48 | 49 |
| 49 void TearDown() override { context_.reset(NULL); } | 50 void TearDown() override { context_.reset(NULL); } |
| 50 | 51 |
| 51 protected: | 52 protected: |
| 52 gpu::gles2::GLES2Interface* gl_; | 53 gpu::gles2::GLES2Interface* gl_; |
| 53 gpu::ContextSupport* context_support_; | 54 gpu::ContextSupport* context_support_; |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 std::unique_ptr<gpu::GLInProcessContext> context_; | 57 std::unique_ptr<gpu::GLInProcessContext> context_; |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 } // namespace | 60 } // namespace |
| 60 | 61 |
| 61 // Include the actual tests. | 62 // Include the actual tests. |
| 62 #define CONTEXT_TEST_F TEST_F | 63 #define CONTEXT_TEST_F TEST_F |
| 63 #include "gpu/ipc/client/gpu_context_tests.h" | 64 #include "gpu/ipc/client/gpu_context_tests.h" |
| OLD | NEW |