OLD | NEW |
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 20 matching lines...) Expand all Loading... |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 #include "ui/base/win/scoped_ole_initializer.h" | 32 #include "ui/base/win/scoped_ole_initializer.h" |
33 #endif | 33 #endif |
34 | 34 |
35 #if defined(USE_AURA) | 35 #if defined(USE_AURA) |
36 #include "ui/aura/test/aura_test_helper.h" | 36 #include "ui/aura/test/aura_test_helper.h" |
37 #include "ui/compositor/test/context_factories_for_test.h" | 37 #include "ui/compositor/test/context_factories_for_test.h" |
38 #include "ui/wm/core/default_activation_client.h" | 38 #include "ui/wm/core/default_activation_client.h" |
39 #endif | 39 #endif |
40 | 40 |
| 41 #if defined(OS_MACOSX) |
| 42 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" |
| 43 #endif |
| 44 |
41 namespace content { | 45 namespace content { |
42 | 46 |
43 // RenderFrameHostTester ------------------------------------------------------ | 47 // RenderFrameHostTester ------------------------------------------------------ |
44 | 48 |
45 // static | 49 // static |
46 RenderFrameHostTester* RenderFrameHostTester::For(RenderFrameHost* host) { | 50 RenderFrameHostTester* RenderFrameHostTester::For(RenderFrameHost* host) { |
47 return static_cast<TestRenderFrameHost*>(host); | 51 return static_cast<TestRenderFrameHost*>(host); |
48 } | 52 } |
49 | 53 |
50 // static | 54 // static |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 211 |
208 sanity_checker_.reset(new ContentBrowserSanityChecker()); | 212 sanity_checker_.reset(new ContentBrowserSanityChecker()); |
209 | 213 |
210 DCHECK(!browser_context_); | 214 DCHECK(!browser_context_); |
211 browser_context_.reset(CreateBrowserContext()); | 215 browser_context_.reset(CreateBrowserContext()); |
212 | 216 |
213 SetContents(CreateTestWebContents()); | 217 SetContents(CreateTestWebContents()); |
214 | 218 |
215 if (IsBrowserSideNavigationEnabled()) | 219 if (IsBrowserSideNavigationEnabled()) |
216 BrowserSideNavigationSetUp(); | 220 BrowserSideNavigationSetUp(); |
| 221 |
| 222 #if defined(OS_MACOSX) |
| 223 ui::WindowResizeHelperMac::Get()->Init( |
| 224 base::MessageLoop::current()->task_runner()); |
| 225 #endif // OS_MACOSX |
217 } | 226 } |
218 | 227 |
219 void RenderViewHostTestHarness::TearDown() { | 228 void RenderViewHostTestHarness::TearDown() { |
220 if (IsBrowserSideNavigationEnabled()) | 229 if (IsBrowserSideNavigationEnabled()) |
221 BrowserSideNavigationTearDown(); | 230 BrowserSideNavigationTearDown(); |
222 | 231 |
223 SetContents(NULL); | 232 SetContents(NULL); |
224 #if defined(USE_AURA) | 233 #if defined(USE_AURA) |
225 aura_test_helper_->TearDown(); | 234 aura_test_helper_->TearDown(); |
226 ui::TerminateContextFactoryForTests(); | 235 ui::TerminateContextFactoryForTests(); |
227 #endif | 236 #endif |
228 // Make sure that we flush any messages related to WebContentsImpl destruction | 237 // Make sure that we flush any messages related to WebContentsImpl destruction |
229 // before we destroy the browser context. | 238 // before we destroy the browser context. |
230 base::RunLoop().RunUntilIdle(); | 239 base::RunLoop().RunUntilIdle(); |
231 | 240 |
| 241 #if defined(OS_MACOSX) |
| 242 ui::WindowResizeHelperMac::Get()->ShutdownForTests(); |
| 243 #endif // OS_MACOSX |
| 244 |
232 #if defined(OS_WIN) | 245 #if defined(OS_WIN) |
233 ole_initializer_.reset(); | 246 ole_initializer_.reset(); |
234 #endif | 247 #endif |
235 | 248 |
236 // Delete any RenderProcessHosts before the BrowserContext goes away. | 249 // Delete any RenderProcessHosts before the BrowserContext goes away. |
237 if (rvh_test_enabler_.rph_factory_) | 250 if (rvh_test_enabler_.rph_factory_) |
238 rvh_test_enabler_.rph_factory_.reset(); | 251 rvh_test_enabler_.rph_factory_.reset(); |
239 | 252 |
240 // Release the browser context by posting itself on the end of the task | 253 // Release the browser context by posting itself on the end of the task |
241 // queue. This is preferable to immediate deletion because it will behave | 254 // queue. This is preferable to immediate deletion because it will behave |
(...skipping 14 matching lines...) Expand all Loading... |
256 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { | 269 BrowserContext* RenderViewHostTestHarness::CreateBrowserContext() { |
257 return new TestBrowserContext(); | 270 return new TestBrowserContext(); |
258 } | 271 } |
259 | 272 |
260 void RenderViewHostTestHarness::SetRenderProcessHostFactory( | 273 void RenderViewHostTestHarness::SetRenderProcessHostFactory( |
261 RenderProcessHostFactory* factory) { | 274 RenderProcessHostFactory* factory) { |
262 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); | 275 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); |
263 } | 276 } |
264 | 277 |
265 } // namespace content | 278 } // namespace content |
OLD | NEW |