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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 8 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 9 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
10 #include "content/common/gpu/client/context_provider_command_buffer.h" | 10 #include "content/common/gpu/client/context_provider_command_buffer.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 using content::WebGraphicsContext3DCommandBufferImpl; | 24 using content::WebGraphicsContext3DCommandBufferImpl; |
25 | 25 |
26 const content::CauseForGpuLaunch kInitCause = | 26 const content::CauseForGpuLaunch kInitCause = |
27 content:: | 27 content:: |
28 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; | 28 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
29 | 29 |
30 class ContextTestBase : public content::ContentBrowserTest { | 30 class ContextTestBase : public content::ContentBrowserTest { |
31 public: | 31 public: |
32 void SetUpOnMainThread() override { | 32 void SetUpOnMainThread() override { |
| 33 // This may leave the provider_ null in some cases, so tests need to early |
| 34 // out. |
33 if (!content::BrowserGpuChannelHostFactory::CanUseForTesting()) | 35 if (!content::BrowserGpuChannelHostFactory::CanUseForTesting()) |
34 return; | 36 return; |
35 | 37 |
36 if (!content::BrowserGpuChannelHostFactory::instance()) | 38 if (!content::BrowserGpuChannelHostFactory::instance()) |
37 content::BrowserGpuChannelHostFactory::Initialize(true); | 39 content::BrowserGpuChannelHostFactory::Initialize(true); |
38 | 40 |
39 content::BrowserGpuChannelHostFactory* factory = | 41 content::BrowserGpuChannelHostFactory* factory = |
40 content::BrowserGpuChannelHostFactory::instance(); | 42 content::BrowserGpuChannelHostFactory::instance(); |
41 CHECK(factory); | 43 CHECK(factory); |
42 base::RunLoop run_loop; | 44 base::RunLoop run_loop; |
(...skipping 21 matching lines...) Expand all Loading... |
64 ContentBrowserTest::SetUpOnMainThread(); | 66 ContentBrowserTest::SetUpOnMainThread(); |
65 } | 67 } |
66 | 68 |
67 void TearDownOnMainThread() override { | 69 void TearDownOnMainThread() override { |
68 // Must delete the context first. | 70 // Must delete the context first. |
69 provider_ = nullptr; | 71 provider_ = nullptr; |
70 ContentBrowserTest::TearDownOnMainThread(); | 72 ContentBrowserTest::TearDownOnMainThread(); |
71 } | 73 } |
72 | 74 |
73 protected: | 75 protected: |
74 gpu::gles2::GLES2Interface* gl_; | 76 gpu::gles2::GLES2Interface* gl_ = nullptr; |
75 gpu::ContextSupport* context_support_; | 77 gpu::ContextSupport* context_support_ = nullptr; |
76 | 78 |
77 private: | 79 private: |
78 scoped_refptr<content::ContextProviderCommandBuffer> provider_; | 80 scoped_refptr<content::ContextProviderCommandBuffer> provider_; |
79 }; | 81 }; |
80 | 82 |
81 } // namespace | 83 } // namespace |
82 | 84 |
83 // Include the shared tests. | 85 // Include the shared tests. |
84 #define CONTEXT_TEST_F IN_PROC_BROWSER_TEST_F | 86 #define CONTEXT_TEST_F IN_PROC_BROWSER_TEST_F |
85 #include "content/common/gpu/client/gpu_context_tests.h" | 87 #include "content/common/gpu/client/gpu_context_tests.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 shim->SimulateCrash(); | 281 shim->SimulateCrash(); |
280 run_loop.Run(); | 282 run_loop.Run(); |
281 | 283 |
282 EXPECT_EQ(1, counter); | 284 EXPECT_EQ(1, counter); |
283 EXPECT_FALSE(IsChannelEstablished()); | 285 EXPECT_FALSE(IsChannelEstablished()); |
284 EstablishAndWait(); | 286 EstablishAndWait(); |
285 EXPECT_TRUE(IsChannelEstablished()); | 287 EXPECT_TRUE(IsChannelEstablished()); |
286 } | 288 } |
287 | 289 |
288 } // namespace content | 290 } // namespace content |
OLD | NEW |