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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 #define MAYBE_CrashAndRecover DISABLED_CrashAndRecover | 202 #define MAYBE_CrashAndRecover DISABLED_CrashAndRecover |
203 #endif | 203 #endif |
204 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, | 204 IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, |
205 MAYBE_CrashAndRecover) { | 205 MAYBE_CrashAndRecover) { |
206 DCHECK(!IsChannelEstablished()); | 206 DCHECK(!IsChannelEstablished()); |
207 EstablishAndWait(); | 207 EstablishAndWait(); |
208 scoped_refptr<GpuChannelHost> host = GetGpuChannel(); | 208 scoped_refptr<GpuChannelHost> host = GetGpuChannel(); |
209 | 209 |
210 scoped_refptr<ContextProviderCommandBuffer> provider = | 210 scoped_refptr<ContextProviderCommandBuffer> provider = |
211 ContextProviderCommandBuffer::Create(CreateContext(), | 211 ContextProviderCommandBuffer::Create(CreateContext(), |
212 "BrowserGpuChannelHostFactoryTest"); | 212 OFFSCREEN_CONTEXT_FOR_TESTING); |
213 base::RunLoop run_loop; | 213 base::RunLoop run_loop; |
214 int counter = 0; | 214 int counter = 0; |
215 provider->SetLostContextCallback( | 215 provider->SetLostContextCallback( |
216 base::Bind(&BrowserGpuChannelHostFactoryTest::OnContextLost, | 216 base::Bind(&BrowserGpuChannelHostFactoryTest::OnContextLost, |
217 base::Unretained(this), run_loop.QuitClosure(), &counter)); | 217 base::Unretained(this), run_loop.QuitClosure(), &counter)); |
218 EXPECT_TRUE(provider->BindToCurrentThread()); | 218 EXPECT_TRUE(provider->BindToCurrentThread()); |
219 GpuProcessHostUIShim* shim = | 219 GpuProcessHostUIShim* shim = |
220 GpuProcessHostUIShim::FromID(GetFactory()->GpuProcessHostId()); | 220 GpuProcessHostUIShim::FromID(GetFactory()->GpuProcessHostId()); |
221 EXPECT_TRUE(shim != NULL); | 221 EXPECT_TRUE(shim != NULL); |
222 shim->SimulateCrash(); | 222 shim->SimulateCrash(); |
223 run_loop.Run(); | 223 run_loop.Run(); |
224 | 224 |
225 EXPECT_EQ(1, counter); | 225 EXPECT_EQ(1, counter); |
226 EXPECT_FALSE(IsChannelEstablished()); | 226 EXPECT_FALSE(IsChannelEstablished()); |
227 EstablishAndWait(); | 227 EstablishAndWait(); |
228 EXPECT_TRUE(IsChannelEstablished()); | 228 EXPECT_TRUE(IsChannelEstablished()); |
229 } | 229 } |
230 | 230 |
231 } // namespace content | 231 } // namespace content |
OLD | NEW |