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

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

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | ui/aura/aura.gyp » ('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 (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/test/test_renderer_host.h" 5 #include "content/test/test_renderer_host.h"
6 6
7 #include "content/browser/renderer_host/render_view_host_factory.h" 7 #include "content/browser/renderer_host/render_view_host_factory.h"
8 #include "content/browser/renderer_host/test_render_view_host.h" 8 #include "content/browser/renderer_host/test_render_view_host.h"
9 #include "content/browser/site_instance_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/browser/web_contents/navigation_entry_impl.h" 10 #include "content/browser/web_contents/navigation_entry_impl.h"
11 #include "content/browser/web_contents/test_web_contents.h" 11 #include "content/browser/web_contents/test_web_contents.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/test/mock_render_process_host.h" 13 #include "content/test/mock_render_process_host.h"
14 #include "content/test/test_browser_context.h" 14 #include "content/test/test_browser_context.h"
15 15
16 #if defined(USE_ASH)
17 #include "ui/aura/test/test_screen.h"
18 #endif
19
20 #if defined(USE_AURA) 16 #if defined(USE_AURA)
21 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
22 #include "ui/aura/monitor_manager.h" 18 #include "ui/aura/monitor_manager.h"
23 #include "ui/aura/root_window.h" 19 #include "ui/aura/root_window.h"
24 #include "ui/aura/single_monitor_manager.h" 20 #include "ui/aura/single_monitor_manager.h"
21 #include "ui/aura/test/test_screen.h"
25 #include "ui/aura/test/test_stacking_client.h" 22 #include "ui/aura/test/test_stacking_client.h"
23 #include "ui/gfx/screen.h"
26 #endif 24 #endif
27 25
28 namespace content { 26 namespace content {
29 27
30 // Manages creation of the RenderViewHosts using our special subclass. This 28 // Manages creation of the RenderViewHosts using our special subclass. This
31 // automatically registers itself when it goes in scope, and unregisters itself 29 // automatically registers itself when it goes in scope, and unregisters itself
32 // when it goes out of scope. Since you can't have more than one factory 30 // when it goes out of scope. Since you can't have more than one factory
33 // registered at a time, you can only have one of these objects at a time. 31 // registered at a time, you can only have one of these objects at a time.
34 // 32 //
35 // This is an implementation detail of this file and used only via 33 // This is an implementation detail of this file and used only via
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 DCHECK(entry); 188 DCHECK(entry);
191 controller().Reload(false); 189 controller().Reload(false);
192 static_cast<TestRenderViewHost*>( 190 static_cast<TestRenderViewHost*>(
193 rvh())->SendNavigate(entry->GetPageID(), entry->GetURL()); 191 rvh())->SendNavigate(entry->GetPageID(), entry->GetURL());
194 } 192 }
195 193
196 void RenderViewHostTestHarness::SetUp() { 194 void RenderViewHostTestHarness::SetUp() {
197 #if defined(USE_AURA) 195 #if defined(USE_AURA)
198 aura::Env::GetInstance()->SetMonitorManager(new aura::SingleMonitorManager); 196 aura::Env::GetInstance()->SetMonitorManager(new aura::SingleMonitorManager);
199 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor()); 197 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor());
200 #if defined(USE_ASH)
201 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); 198 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get()));
202 #endif // USE_ASH
203 test_stacking_client_.reset( 199 test_stacking_client_.reset(
204 new aura::test::TestStackingClient(root_window_.get())); 200 new aura::test::TestStackingClient(root_window_.get()));
205 #endif // USE_AURA 201 #endif // USE_AURA
206 SetContents(CreateTestWebContents()); 202 SetContents(CreateTestWebContents());
207 } 203 }
208 204
209 void RenderViewHostTestHarness::TearDown() { 205 void RenderViewHostTestHarness::TearDown() {
210 SetContents(NULL); 206 SetContents(NULL);
211 #if defined(USE_AURA) 207 #if defined(USE_AURA)
212 test_stacking_client_.reset(); 208 test_stacking_client_.reset();
213 root_window_.reset(); 209 root_window_.reset();
214 #endif 210 #endif
215 211
216 // Make sure that we flush any messages related to WebContentsImpl destruction 212 // Make sure that we flush any messages related to WebContentsImpl destruction
217 // before we destroy the browser context. 213 // before we destroy the browser context.
218 MessageLoop::current()->RunAllPending(); 214 MessageLoop::current()->RunAllPending();
219 215
220 // Release the browser context on the UI thread. 216 // Release the browser context on the UI thread.
221 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); 217 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release());
222 message_loop_.RunAllPending(); 218 message_loop_.RunAllPending();
223 } 219 }
224 220
225 void RenderViewHostTestHarness::SetRenderProcessHostFactory( 221 void RenderViewHostTestHarness::SetRenderProcessHostFactory(
226 RenderProcessHostFactory* factory) { 222 RenderProcessHostFactory* factory) {
227 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); 223 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory);
228 } 224 }
229 225
230 } // namespace content 226 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | ui/aura/aura.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698