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 #include <cmath> | 6 #include <cmath> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 10 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| 11 #include "gpu/command_buffer/client/gles2_implementation.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "ui/gl/gl_surface.h" | 13 #include "ui/gl/gl_surface.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 using gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl; | |
17 | |
18 class ContextTestBase : public testing::Test { | 17 class ContextTestBase : public testing::Test { |
19 public: | 18 public: |
20 void SetUp() override { | 19 void SetUp() override { |
21 blink::WebGraphicsContext3D::Attributes attributes; | 20 gpu::gles2::ContextCreationAttribHelper attributes; |
22 bool lose_context_when_out_of_memory = false; | 21 attributes.alpha_size = 8; |
23 typedef WebGraphicsContext3DInProcessCommandBufferImpl WGC3DIPCBI; | 22 attributes.depth_size = 24; |
24 context_ = WGC3DIPCBI::CreateOffscreenContext( | 23 attributes.red_size = 8; |
25 attributes, lose_context_when_out_of_memory); | 24 attributes.green_size = 8; |
26 context_->InitializeOnCurrentThread(); | 25 attributes.blue_size = 8; |
27 context_support_ = context_->GetContextSupport(); | 26 attributes.stencil_size = 8; |
| 27 attributes.samples = 4; |
| 28 attributes.sample_buffers = 1; |
| 29 attributes.bind_generates_resource = false; |
| 30 |
| 31 context_.reset(gpu::GLInProcessContext::Create( |
| 32 nullptr, /* service */ |
| 33 nullptr, /* surface */ |
| 34 true, /* offscreen */ |
| 35 gfx::kNullAcceleratedWidget, /* window */ |
| 36 gfx::Size(1, 1), /* size */ |
| 37 nullptr, /* share_context */ |
| 38 true, /* use_global_share_group */ |
| 39 attributes, gfx::PreferDiscreteGpu, |
| 40 ::gpu::GLInProcessContextSharedMemoryLimits(), |
| 41 nullptr, /* gpu_memory_buffer_manager */ |
| 42 nullptr /* image_factory */)); |
| 43 gl_ = context_->GetImplementation(); |
| 44 context_support_ = context_->GetImplementation(); |
28 } | 45 } |
29 | 46 |
30 void TearDown() override { context_.reset(NULL); } | 47 void TearDown() override { context_.reset(NULL); } |
31 | 48 |
32 protected: | 49 protected: |
33 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context_; | 50 gpu::gles2::GLES2Interface* gl_; |
34 gpu::ContextSupport* context_support_; | 51 gpu::ContextSupport* context_support_; |
| 52 |
| 53 private: |
| 54 scoped_ptr<gpu::GLInProcessContext> context_; |
35 }; | 55 }; |
36 | 56 |
37 } // namespace | 57 } // namespace |
38 | 58 |
39 // Include the actual tests. | 59 // Include the actual tests. |
40 #define CONTEXT_TEST_F TEST_F | 60 #define CONTEXT_TEST_F TEST_F |
41 #include "content/common/gpu/client/gpu_context_tests.h" | 61 #include "content/common/gpu/client/gpu_context_tests.h" |
OLD | NEW |