| 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/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/browser/compositor/image_transport_factory.h" | 9 #include "content/browser/compositor/image_transport_factory.h" |
| 10 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 10 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 11 #include "content/browser/gpu/gpu_process_host.h" | 11 #include "content/browser/gpu/gpu_process_host.h" |
| 12 #include "content/public/browser/gpu_data_manager.h" | 12 #include "content/public/browser/gpu_data_manager.h" |
| 13 #include "content/public/browser/gpu_utils.h" |
| 13 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 14 #include "content/public/test/content_browser_test.h" | 15 #include "content/public/test/content_browser_test.h" |
| 15 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" | 16 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" |
| 16 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 17 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
| 17 #include "third_party/skia/include/core/SkCanvas.h" | 18 #include "third_party/skia/include/core/SkCanvas.h" |
| 18 #include "third_party/skia/include/core/SkPaint.h" | 19 #include "third_party/skia/include/core/SkPaint.h" |
| 19 #include "third_party/skia/include/core/SkSurface.h" | 20 #include "third_party/skia/include/core/SkSurface.h" |
| 20 #include "third_party/skia/include/gpu/GrContext.h" | 21 #include "third_party/skia/include/gpu/GrContext.h" |
| 21 #include "ui/gl/gl_switches.h" | 22 #include "ui/gl/gl_switches.h" |
| 22 | 23 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 scoped_refptr<gpu::GpuChannelHost> host = GetGpuChannel(); | 278 scoped_refptr<gpu::GpuChannelHost> host = GetGpuChannel(); |
| 278 | 279 |
| 279 scoped_refptr<ui::ContextProviderCommandBuffer> provider = | 280 scoped_refptr<ui::ContextProviderCommandBuffer> provider = |
| 280 CreateContext(GetGpuChannel()); | 281 CreateContext(GetGpuChannel()); |
| 281 base::RunLoop run_loop; | 282 base::RunLoop run_loop; |
| 282 int counter = 0; | 283 int counter = 0; |
| 283 provider->SetLostContextCallback( | 284 provider->SetLostContextCallback( |
| 284 base::Bind(&BrowserGpuChannelHostFactoryTest::OnContextLost, | 285 base::Bind(&BrowserGpuChannelHostFactoryTest::OnContextLost, |
| 285 base::Unretained(this), run_loop.QuitClosure(), &counter)); | 286 base::Unretained(this), run_loop.QuitClosure(), &counter)); |
| 286 EXPECT_TRUE(provider->BindToCurrentThread()); | 287 EXPECT_TRUE(provider->BindToCurrentThread()); |
| 287 GpuProcessHost::CallOnIO( | 288 GpuProcessHost::CallOnIO(GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, |
| 288 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, false /* force_create */, | 289 false /* force_create */, |
| 289 base::Bind([](GpuProcessHost* host) { host->gpu_service()->Crash(); })); | 290 base::Bind([](GpuProcessHost* host) { |
| 291 if (host) |
| 292 host->gpu_service()->Crash(); |
| 293 })); |
| 290 run_loop.Run(); | 294 run_loop.Run(); |
| 291 | 295 |
| 292 EXPECT_EQ(1, counter); | 296 EXPECT_EQ(1, counter); |
| 293 EXPECT_FALSE(IsChannelEstablished()); | 297 EXPECT_FALSE(IsChannelEstablished()); |
| 294 EstablishAndWait(); | 298 EstablishAndWait(); |
| 295 EXPECT_TRUE(IsChannelEstablished()); | 299 EXPECT_TRUE(IsChannelEstablished()); |
| 296 } | 300 } |
| 297 | 301 |
| 302 using GpuProcessHostBrowserTest = BrowserGpuChannelHostFactoryTest; |
| 303 |
| 304 IN_PROC_BROWSER_TEST_F(GpuProcessHostBrowserTest, Shutdown) { |
| 305 DCHECK(!IsChannelEstablished()); |
| 306 EstablishAndWait(); |
| 307 base::RunLoop run_loop; |
| 308 StopGpuProcess(run_loop.QuitClosure()); |
| 309 run_loop.Run(); |
| 310 } |
| 311 |
| 298 } // namespace content | 312 } // namespace content |
| OLD | NEW |