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

Side by Side Diff: content/public/test/test_renderer_host.cc

Issue 2005013002: mac: ensure ui::Compositor exists for visible RWHVs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More unit test fixes Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/public/test/test_renderer_host.h" 5 #include "content/public/test/test_renderer_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 19 matching lines...) Expand all
30 #if defined(OS_WIN) 30 #if defined(OS_WIN)
31 #include "ui/base/win/scoped_ole_initializer.h" 31 #include "ui/base/win/scoped_ole_initializer.h"
32 #endif 32 #endif
33 33
34 #if defined(USE_AURA) 34 #if defined(USE_AURA)
35 #include "ui/aura/test/aura_test_helper.h" 35 #include "ui/aura/test/aura_test_helper.h"
36 #include "ui/compositor/test/context_factories_for_test.h" 36 #include "ui/compositor/test/context_factories_for_test.h"
37 #include "ui/wm/core/default_activation_client.h" 37 #include "ui/wm/core/default_activation_client.h"
38 #endif 38 #endif
39 39
40 #if defined(OS_MACOSX)
41 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
42 #endif
43
40 namespace content { 44 namespace content {
41 45
42 // RenderFrameHostTester ------------------------------------------------------ 46 // RenderFrameHostTester ------------------------------------------------------
43 47
44 // static 48 // static
45 RenderFrameHostTester* RenderFrameHostTester::For(RenderFrameHost* host) { 49 RenderFrameHostTester* RenderFrameHostTester::For(RenderFrameHost* host) {
46 return static_cast<TestRenderFrameHost*>(host); 50 return static_cast<TestRenderFrameHost*>(host);
47 } 51 }
48 52
49 // static 53 // static
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 #if defined(USE_AURA) 197 #if defined(USE_AURA)
194 // The ContextFactory must exist before any Compositors are created. 198 // The ContextFactory must exist before any Compositors are created.
195 bool enable_pixel_output = false; 199 bool enable_pixel_output = false;
196 ui::ContextFactory* context_factory = 200 ui::ContextFactory* context_factory =
197 ui::InitializeContextFactoryForTests(enable_pixel_output); 201 ui::InitializeContextFactoryForTests(enable_pixel_output);
198 202
199 aura_test_helper_.reset( 203 aura_test_helper_.reset(
200 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); 204 new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
201 aura_test_helper_->SetUp(context_factory); 205 aura_test_helper_->SetUp(context_factory);
202 new wm::DefaultActivationClient(aura_test_helper_->root_window()); 206 new wm::DefaultActivationClient(aura_test_helper_->root_window());
203 #endif 207 #endif // USE_AURA
204 208
205 sanity_checker_.reset(new ContentBrowserSanityChecker()); 209 sanity_checker_.reset(new ContentBrowserSanityChecker());
206 210
207 DCHECK(!browser_context_); 211 DCHECK(!browser_context_);
208 browser_context_.reset(CreateBrowserContext()); 212 browser_context_.reset(CreateBrowserContext());
209 213
210 SetContents(CreateTestWebContents()); 214 SetContents(CreateTestWebContents());
211 215
212 if (IsBrowserSideNavigationEnabled()) 216 if (IsBrowserSideNavigationEnabled())
213 BrowserSideNavigationSetUp(); 217 BrowserSideNavigationSetUp();
218
219 #if defined(OS_MACOSX)
220 if (!ui::WindowResizeHelperMac::Get()->task_runner()) {
enne (OOO) 2016/05/26 00:07:06 I'd love some feedback on what I should do here.
ccameron 2016/05/26 00:11:45 Adding a Shutdown that tests use to clear this sou
221 ui::WindowResizeHelperMac::Get()->Init(
222 base::MessageLoop::current()->task_runner());
223 }
224 #endif // OS_MACOSX
214 } 225 }
215 226
216 void RenderViewHostTestHarness::TearDown() { 227 void RenderViewHostTestHarness::TearDown() {
217 if (IsBrowserSideNavigationEnabled()) 228 if (IsBrowserSideNavigationEnabled())
218 BrowserSideNavigationTearDown(); 229 BrowserSideNavigationTearDown();
219 230
220 SetContents(NULL); 231 SetContents(NULL);
221 #if defined(USE_AURA) 232 #if defined(USE_AURA)
222 aura_test_helper_->TearDown(); 233 aura_test_helper_->TearDown();
223 ui::TerminateContextFactoryForTests(); 234 ui::TerminateContextFactoryForTests();
(...skipping 23 matching lines...) Expand all
247 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { 258 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() {
248 return new TestBrowserContext(); 259 return new TestBrowserContext();
249 } 260 }
250 261
251 void RenderViewHostTestHarness::SetRenderProcessHostFactory( 262 void RenderViewHostTestHarness::SetRenderProcessHostFactory(
252 RenderProcessHostFactory* factory) { 263 RenderProcessHostFactory* factory) {
253 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); 264 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory);
254 } 265 }
255 266
256 } // namespace content 267 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698