| 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_ui_shim.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/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 14 #include "content/public/test/content_browser_test.h" | 14 #include "content/public/test/content_browser_test.h" |
| 15 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" |
| 15 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 16 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
| 16 #include "third_party/skia/include/core/SkCanvas.h" | 17 #include "third_party/skia/include/core/SkCanvas.h" |
| 17 #include "third_party/skia/include/core/SkPaint.h" | 18 #include "third_party/skia/include/core/SkPaint.h" |
| 18 #include "third_party/skia/include/core/SkSurface.h" | 19 #include "third_party/skia/include/core/SkSurface.h" |
| 19 #include "third_party/skia/include/gpu/GrContext.h" | 20 #include "third_party/skia/include/gpu/GrContext.h" |
| 20 #include "ui/gl/gl_switches.h" | 21 #include "ui/gl/gl_switches.h" |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 scoped_refptr<ui::ContextProviderCommandBuffer> CreateContext( | 25 scoped_refptr<ui::ContextProviderCommandBuffer> CreateContext( |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 scoped_refptr<gpu::GpuChannelHost> host = GetGpuChannel(); | 277 scoped_refptr<gpu::GpuChannelHost> host = GetGpuChannel(); |
| 277 | 278 |
| 278 scoped_refptr<ui::ContextProviderCommandBuffer> provider = | 279 scoped_refptr<ui::ContextProviderCommandBuffer> provider = |
| 279 CreateContext(GetGpuChannel()); | 280 CreateContext(GetGpuChannel()); |
| 280 base::RunLoop run_loop; | 281 base::RunLoop run_loop; |
| 281 int counter = 0; | 282 int counter = 0; |
| 282 provider->SetLostContextCallback( | 283 provider->SetLostContextCallback( |
| 283 base::Bind(&BrowserGpuChannelHostFactoryTest::OnContextLost, | 284 base::Bind(&BrowserGpuChannelHostFactoryTest::OnContextLost, |
| 284 base::Unretained(this), run_loop.QuitClosure(), &counter)); | 285 base::Unretained(this), run_loop.QuitClosure(), &counter)); |
| 285 EXPECT_TRUE(provider->BindToCurrentThread()); | 286 EXPECT_TRUE(provider->BindToCurrentThread()); |
| 286 GpuProcessHostUIShim* shim = | 287 GpuProcessHost::CallOnIO( |
| 287 GpuProcessHostUIShim::FromID(GetFactory()->GpuProcessHostId()); | 288 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED, false /* force_create */, |
| 288 EXPECT_TRUE(shim != NULL); | 289 base::Bind([](GpuProcessHost* host) { host->gpu_service()->Crash(); })); |
| 289 shim->SimulateCrash(); | |
| 290 run_loop.Run(); | 290 run_loop.Run(); |
| 291 | 291 |
| 292 EXPECT_EQ(1, counter); | 292 EXPECT_EQ(1, counter); |
| 293 EXPECT_FALSE(IsChannelEstablished()); | 293 EXPECT_FALSE(IsChannelEstablished()); |
| 294 EstablishAndWait(); | 294 EstablishAndWait(); |
| 295 EXPECT_TRUE(IsChannelEstablished()); | 295 EXPECT_TRUE(IsChannelEstablished()); |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace content | 298 } // namespace content |
| OLD | NEW |