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 24 matching lines...) Expand all Loading... |
35 content::BrowserGpuChannelHostFactory* factory = | 35 content::BrowserGpuChannelHostFactory* factory = |
36 content::BrowserGpuChannelHostFactory::instance(); | 36 content::BrowserGpuChannelHostFactory::instance(); |
37 CHECK(factory); | 37 CHECK(factory); |
38 scoped_refptr<content::GpuChannelHost> gpu_channel_host( | 38 scoped_refptr<content::GpuChannelHost> gpu_channel_host( |
39 factory->EstablishGpuChannelSync(kInitCause)); | 39 factory->EstablishGpuChannelSync(kInitCause)); |
40 context_.reset( | 40 context_.reset( |
41 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 41 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
42 gpu_channel_host.get(), | 42 gpu_channel_host.get(), |
43 blink::WebGraphicsContext3D::Attributes(), | 43 blink::WebGraphicsContext3D::Attributes(), |
44 GURL(), | 44 GURL(), |
45 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())); | 45 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
| 46 NULL)); |
46 CHECK(context_.get()); | 47 CHECK(context_.get()); |
47 context_->makeContextCurrent(); | 48 context_->makeContextCurrent(); |
48 context_support_ = context_->GetContextSupport(); | 49 context_support_ = context_->GetContextSupport(); |
49 ContentBrowserTest::SetUpOnMainThread(); | 50 ContentBrowserTest::SetUpOnMainThread(); |
50 } | 51 } |
51 | 52 |
52 virtual void TearDownOnMainThread() OVERRIDE { | 53 virtual void TearDownOnMainThread() OVERRIDE { |
53 // Must delete the context first. | 54 // Must delete the context first. |
54 context_.reset(NULL); | 55 context_.reset(NULL); |
55 ContentBrowserTest::TearDownOnMainThread(); | 56 ContentBrowserTest::TearDownOnMainThread(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 CHECK_EQ(*event, false); | 123 CHECK_EQ(*event, false); |
123 *event = true; | 124 *event = true; |
124 } | 125 } |
125 | 126 |
126 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() { | 127 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() { |
127 return make_scoped_ptr( | 128 return make_scoped_ptr( |
128 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 129 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
129 GetGpuChannel(), | 130 GetGpuChannel(), |
130 blink::WebGraphicsContext3D::Attributes(), | 131 blink::WebGraphicsContext3D::Attributes(), |
131 GURL(), | 132 GURL(), |
132 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())); | 133 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
| 134 NULL)); |
133 } | 135 } |
134 }; | 136 }; |
135 | 137 |
136 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, Basic) { | 138 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, Basic) { |
137 if (!context_) | 139 if (!context_) |
138 return; | 140 return; |
139 | 141 |
140 DCHECK(!IsChannelEstablished()); | 142 DCHECK(!IsChannelEstablished()); |
141 EstablishAndWait(); | 143 EstablishAndWait(); |
142 EXPECT_TRUE(GetGpuChannel() != NULL); | 144 EXPECT_TRUE(GetGpuChannel() != NULL); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 shim->SimulateCrash(); | 198 shim->SimulateCrash(); |
197 run_loop.Run(); | 199 run_loop.Run(); |
198 | 200 |
199 EXPECT_EQ(1, counter); | 201 EXPECT_EQ(1, counter); |
200 EXPECT_FALSE(IsChannelEstablished()); | 202 EXPECT_FALSE(IsChannelEstablished()); |
201 EstablishAndWait(); | 203 EstablishAndWait(); |
202 EXPECT_TRUE(IsChannelEstablished()); | 204 EXPECT_TRUE(IsChannelEstablished()); |
203 } | 205 } |
204 | 206 |
205 } // namespace content | 207 } // namespace content |
OLD | NEW |