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

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: Move dcheck Created 4 years, 6 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 ui::WindowResizeHelperMac::Get()->Init(
221 base::MessageLoop::current()->task_runner());
222 #endif // OS_MACOSX
214 } 223 }
215 224
216 void RenderViewHostTestHarness::TearDown() { 225 void RenderViewHostTestHarness::TearDown() {
217 if (IsBrowserSideNavigationEnabled()) 226 if (IsBrowserSideNavigationEnabled())
218 BrowserSideNavigationTearDown(); 227 BrowserSideNavigationTearDown();
219 228
220 SetContents(NULL); 229 SetContents(NULL);
221 #if defined(USE_AURA) 230 #if defined(USE_AURA)
222 aura_test_helper_->TearDown(); 231 aura_test_helper_->TearDown();
223 ui::TerminateContextFactoryForTests(); 232 ui::TerminateContextFactoryForTests();
224 #endif 233 #endif
225 // Make sure that we flush any messages related to WebContentsImpl destruction 234 // Make sure that we flush any messages related to WebContentsImpl destruction
226 // before we destroy the browser context. 235 // before we destroy the browser context.
227 base::RunLoop().RunUntilIdle(); 236 base::RunLoop().RunUntilIdle();
228 237
238 #if defined(OS_MACOSX)
239 ui::WindowResizeHelperMac::Get()->ShutdownForTests();
240 #endif // OS_MACOSX
241
229 #if defined(OS_WIN) 242 #if defined(OS_WIN)
230 ole_initializer_.reset(); 243 ole_initializer_.reset();
231 #endif 244 #endif
232 245
233 // Delete any RenderProcessHosts before the BrowserContext goes away. 246 // Delete any RenderProcessHosts before the BrowserContext goes away.
234 if (rvh_test_enabler_.rph_factory_) 247 if (rvh_test_enabler_.rph_factory_)
235 rvh_test_enabler_.rph_factory_.reset(); 248 rvh_test_enabler_.rph_factory_.reset();
236 249
237 // Release the browser context by posting itself on the end of the task 250 // Release the browser context by posting itself on the end of the task
238 // queue. This is preferable to immediate deletion because it will behave 251 // queue. This is preferable to immediate deletion because it will behave
239 // properly if the |rph_factory_| reset above enqueued any tasks which 252 // properly if the |rph_factory_| reset above enqueued any tasks which
240 // depend on |browser_context_|. 253 // depend on |browser_context_|.
241 BrowserThread::DeleteSoon(content::BrowserThread::UI, 254 BrowserThread::DeleteSoon(content::BrowserThread::UI,
242 FROM_HERE, 255 FROM_HERE,
243 browser_context_.release()); 256 browser_context_.release());
244 thread_bundle_.reset(); 257 thread_bundle_.reset();
245 } 258 }
246 259
247 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { 260 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() {
248 return new TestBrowserContext(); 261 return new TestBrowserContext();
249 } 262 }
250 263
251 void RenderViewHostTestHarness::SetRenderProcessHostFactory( 264 void RenderViewHostTestHarness::SetRenderProcessHostFactory(
252 RenderProcessHostFactory* factory) { 265 RenderProcessHostFactory* factory) {
253 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); 266 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory);
254 } 267 }
255 268
256 } // namespace content 269 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698