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 17 matching lines...) Expand all Loading... |
28 content::BrowserGpuChannelHostFactory* factory = | 28 content::BrowserGpuChannelHostFactory* factory = |
29 content::BrowserGpuChannelHostFactory::instance(); | 29 content::BrowserGpuChannelHostFactory::instance(); |
30 CHECK(factory); | 30 CHECK(factory); |
31 scoped_refptr<content::GpuChannelHost> gpu_channel_host( | 31 scoped_refptr<content::GpuChannelHost> gpu_channel_host( |
32 factory->EstablishGpuChannelSync( | 32 factory->EstablishGpuChannelSync( |
33 content:: | 33 content:: |
34 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITI
ALIZE)); | 34 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITI
ALIZE)); |
35 context_.reset( | 35 context_.reset( |
36 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 36 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
37 gpu_channel_host.get(), | 37 gpu_channel_host.get(), |
38 WebKit::WebGraphicsContext3D::Attributes(), | 38 blink::WebGraphicsContext3D::Attributes(), |
39 GURL())); | 39 GURL())); |
40 CHECK(context_.get()); | 40 CHECK(context_.get()); |
41 context_->makeContextCurrent(); | 41 context_->makeContextCurrent(); |
42 context_support_ = context_->GetContextSupport(); | 42 context_support_ = context_->GetContextSupport(); |
43 ContentBrowserTest::SetUpOnMainThread(); | 43 ContentBrowserTest::SetUpOnMainThread(); |
44 } | 44 } |
45 | 45 |
46 virtual void TearDownOnMainThread() OVERRIDE { | 46 virtual void TearDownOnMainThread() OVERRIDE { |
47 // Must delete the context first. | 47 // Must delete the context first. |
48 context_.reset(NULL); | 48 context_.reset(NULL); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 static void Signal(bool *event) { | 114 static void Signal(bool *event) { |
115 CHECK_EQ(*event, false); | 115 CHECK_EQ(*event, false); |
116 *event = true; | 116 *event = true; |
117 } | 117 } |
118 | 118 |
119 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() { | 119 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() { |
120 return make_scoped_ptr( | 120 return make_scoped_ptr( |
121 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 121 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
122 GetGpuChannel(), | 122 GetGpuChannel(), |
123 WebKit::WebGraphicsContext3D::Attributes(), | 123 blink::WebGraphicsContext3D::Attributes(), |
124 GURL())); | 124 GURL())); |
125 } | 125 } |
126 }; | 126 }; |
127 | 127 |
128 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, Basic) { | 128 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, Basic) { |
129 DCHECK(!IsChannelEstablished()); | 129 DCHECK(!IsChannelEstablished()); |
130 EstablishAndWait(); | 130 EstablishAndWait(); |
131 EXPECT_TRUE(GetGpuChannel() != NULL); | 131 EXPECT_TRUE(GetGpuChannel() != NULL); |
132 } | 132 } |
133 | 133 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 shim->SimulateCrash(); | 179 shim->SimulateCrash(); |
180 run_loop.Run(); | 180 run_loop.Run(); |
181 | 181 |
182 EXPECT_EQ(1, counter); | 182 EXPECT_EQ(1, counter); |
183 EXPECT_FALSE(IsChannelEstablished()); | 183 EXPECT_FALSE(IsChannelEstablished()); |
184 EstablishAndWait(); | 184 EstablishAndWait(); |
185 EXPECT_TRUE(IsChannelEstablished()); | 185 EXPECT_TRUE(IsChannelEstablished()); |
186 } | 186 } |
187 | 187 |
188 } // namespace content | 188 } // namespace content |
OLD | NEW |