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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 7 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
8 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 8 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
9 #include "content/common/gpu/client/context_provider_command_buffer.h" | 9 #include "content/common/gpu/client/context_provider_command_buffer.h" |
10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 10 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 CHECK(factory); | 34 CHECK(factory); |
35 scoped_refptr<content::GpuChannelHost> gpu_channel_host( | 35 scoped_refptr<content::GpuChannelHost> gpu_channel_host( |
36 factory->EstablishGpuChannelSync( | 36 factory->EstablishGpuChannelSync( |
37 content:: | 37 content:: |
38 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITI
ALIZE)); | 38 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITI
ALIZE)); |
39 context_.reset( | 39 context_.reset( |
40 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 40 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
41 gpu_channel_host.get(), | 41 gpu_channel_host.get(), |
42 blink::WebGraphicsContext3D::Attributes(), | 42 blink::WebGraphicsContext3D::Attributes(), |
43 GURL(), | 43 GURL(), |
44 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())); | 44 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
| 45 NULL)); |
45 CHECK(context_.get()); | 46 CHECK(context_.get()); |
46 context_->makeContextCurrent(); | 47 context_->makeContextCurrent(); |
47 context_support_ = context_->GetContextSupport(); | 48 context_support_ = context_->GetContextSupport(); |
48 ContentBrowserTest::SetUpOnMainThread(); | 49 ContentBrowserTest::SetUpOnMainThread(); |
49 } | 50 } |
50 | 51 |
51 virtual void TearDownOnMainThread() OVERRIDE { | 52 virtual void TearDownOnMainThread() OVERRIDE { |
52 // Must delete the context first. | 53 // Must delete the context first. |
53 context_.reset(NULL); | 54 context_.reset(NULL); |
54 ContentBrowserTest::TearDownOnMainThread(); | 55 ContentBrowserTest::TearDownOnMainThread(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 CHECK_EQ(*event, false); | 124 CHECK_EQ(*event, false); |
124 *event = true; | 125 *event = true; |
125 } | 126 } |
126 | 127 |
127 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() { | 128 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() { |
128 return make_scoped_ptr( | 129 return make_scoped_ptr( |
129 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 130 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
130 GetGpuChannel(), | 131 GetGpuChannel(), |
131 blink::WebGraphicsContext3D::Attributes(), | 132 blink::WebGraphicsContext3D::Attributes(), |
132 GURL(), | 133 GURL(), |
133 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())); | 134 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
| 135 NULL)); |
134 } | 136 } |
135 }; | 137 }; |
136 | 138 |
137 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, Basic) { | 139 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, Basic) { |
138 if (!context_) | 140 if (!context_) |
139 return; | 141 return; |
140 | 142 |
141 DCHECK(!IsChannelEstablished()); | 143 DCHECK(!IsChannelEstablished()); |
142 EstablishAndWait(); | 144 EstablishAndWait(); |
143 EXPECT_TRUE(GetGpuChannel() != NULL); | 145 EXPECT_TRUE(GetGpuChannel() != NULL); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 shim->SimulateCrash(); | 202 shim->SimulateCrash(); |
201 run_loop.Run(); | 203 run_loop.Run(); |
202 | 204 |
203 EXPECT_EQ(1, counter); | 205 EXPECT_EQ(1, counter); |
204 EXPECT_FALSE(IsChannelEstablished()); | 206 EXPECT_FALSE(IsChannelEstablished()); |
205 EstablishAndWait(); | 207 EstablishAndWait(); |
206 EXPECT_TRUE(IsChannelEstablished()); | 208 EXPECT_TRUE(IsChannelEstablished()); |
207 } | 209 } |
208 | 210 |
209 } // namespace content | 211 } // namespace content |
OLD | NEW |