Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: content/browser/gpu/gpu_ipc_browsertests.cc

Issue 1807813002: Remove WebGraphicsContext3D dependency in gpu_context_tests.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wgc3d-unused
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/common/gpu/client/gpu_context_tests.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 void SetUpOnMainThread() override { 32 void SetUpOnMainThread() override {
33 if (!content::BrowserGpuChannelHostFactory::CanUseForTesting()) 33 if (!content::BrowserGpuChannelHostFactory::CanUseForTesting())
34 return; 34 return;
35 35
36 if (!content::BrowserGpuChannelHostFactory::instance()) 36 if (!content::BrowserGpuChannelHostFactory::instance())
37 content::BrowserGpuChannelHostFactory::Initialize(true); 37 content::BrowserGpuChannelHostFactory::Initialize(true);
38 38
39 content::BrowserGpuChannelHostFactory* factory = 39 content::BrowserGpuChannelHostFactory* factory =
40 content::BrowserGpuChannelHostFactory::instance(); 40 content::BrowserGpuChannelHostFactory::instance();
41 CHECK(factory); 41 CHECK(factory);
42 bool lose_context_when_out_of_memory = false;
43 base::RunLoop run_loop; 42 base::RunLoop run_loop;
44 factory->EstablishGpuChannel(kInitCause, run_loop.QuitClosure()); 43 factory->EstablishGpuChannel(kInitCause, run_loop.QuitClosure());
45 run_loop.Run(); 44 run_loop.Run();
46 scoped_refptr<content::GpuChannelHost> 45 scoped_refptr<content::GpuChannelHost>
47 gpu_channel_host(factory->GetGpuChannel()); 46 gpu_channel_host(factory->GetGpuChannel());
48 DCHECK(gpu_channel_host.get()); 47 CHECK(gpu_channel_host.get());
49 context_.reset( 48
49 bool lose_context_when_out_of_memory = false;
50 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> web_context(
50 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 51 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
51 gpu_channel_host.get(), 52 gpu_channel_host.get(), blink::WebGraphicsContext3D::Attributes(),
52 blink::WebGraphicsContext3D::Attributes(), 53 lose_context_when_out_of_memory, GURL(),
53 lose_context_when_out_of_memory,
54 GURL(),
55 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), 54 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
56 NULL)); 55 nullptr));
57 CHECK(context_.get()); 56
58 context_->InitializeOnCurrentThread(); 57 provider_ = content::ContextProviderCommandBuffer::Create(
59 context_support_ = context_->GetContextSupport(); 58 std::move(web_context), content::OFFSCREEN_CONTEXT_FOR_TESTING);
59 bool bound = provider_->BindToCurrentThread();
60 CHECK(bound);
61 gl_ = provider_->ContextGL();
62 context_support_ = provider_->ContextSupport();
63
60 ContentBrowserTest::SetUpOnMainThread(); 64 ContentBrowserTest::SetUpOnMainThread();
61 } 65 }
62 66
63 void TearDownOnMainThread() override { 67 void TearDownOnMainThread() override {
64 // Must delete the context first. 68 // Must delete the context first.
65 context_.reset(NULL); 69 provider_ = nullptr;
66 ContentBrowserTest::TearDownOnMainThread(); 70 ContentBrowserTest::TearDownOnMainThread();
67 } 71 }
68 72
69 protected: 73 protected:
70 scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl> context_; 74 gpu::gles2::GLES2Interface* gl_;
71 gpu::ContextSupport* context_support_; 75 gpu::ContextSupport* context_support_;
76
77 private:
78 scoped_refptr<content::ContextProviderCommandBuffer> provider_;
72 }; 79 };
73 80
74 } // namespace 81 } // namespace
75 82
76 // Include the shared tests. 83 // Include the shared tests.
77 #define CONTEXT_TEST_F IN_PROC_BROWSER_TEST_F 84 #define CONTEXT_TEST_F IN_PROC_BROWSER_TEST_F
78 #include "content/common/gpu/client/gpu_context_tests.h" 85 #include "content/common/gpu/client/gpu_context_tests.h"
79 86
80 namespace content { 87 namespace content {
81 88
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 shim->SimulateCrash(); 279 shim->SimulateCrash();
273 run_loop.Run(); 280 run_loop.Run();
274 281
275 EXPECT_EQ(1, counter); 282 EXPECT_EQ(1, counter);
276 EXPECT_FALSE(IsChannelEstablished()); 283 EXPECT_FALSE(IsChannelEstablished());
277 EstablishAndWait(); 284 EstablishAndWait();
278 EXPECT_TRUE(IsChannelEstablished()); 285 EXPECT_TRUE(IsChannelEstablished());
279 } 286 }
280 287
281 } // namespace content 288 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/client/gpu_context_tests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698