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

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

Issue 9701098: MultiMonitor support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang fix Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/base/browser_with_test_window_test.cc ('k') | ui/aura/demo/demo_main.cc » ('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/tab_contents/navigation_entry_impl.h" 10 #include "content/browser/tab_contents/navigation_entry_impl.h"
11 #include "content/browser/tab_contents/test_tab_contents.h" 11 #include "content/browser/tab_contents/test_tab_contents.h"
12 #include "content/test/mock_render_process_host.h" 12 #include "content/test/mock_render_process_host.h"
13 #include "content/test/test_browser_context.h" 13 #include "content/test/test_browser_context.h"
14 14
15 #if defined(USE_AURA) 15 #if defined(USE_AURA)
16 #include "ui/aura/monitor_manager.h"
16 #include "ui/aura/root_window.h" 17 #include "ui/aura/root_window.h"
17 #include "ui/aura/test/test_screen.h" 18 #include "ui/aura/test/test_screen.h"
18 #include "ui/aura/test/test_stacking_client.h" 19 #include "ui/aura/test/test_stacking_client.h"
19 #endif 20 #endif
20 21
21 namespace content { 22 namespace content {
22 23
23 // Manages creation of the RenderViewHosts using our special subclass. This 24 // Manages creation of the RenderViewHosts using our special subclass. This
24 // automatically registers itself when it goes in scope, and unregisters itself 25 // automatically registers itself when it goes in scope, and unregisters itself
25 // when it goes out of scope. Since you can't have more than one factory 26 // when it goes out of scope. Since you can't have more than one factory
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 void RenderViewHostTestHarness::Reload() { 175 void RenderViewHostTestHarness::Reload() {
175 NavigationEntry* entry = controller().GetLastCommittedEntry(); 176 NavigationEntry* entry = controller().GetLastCommittedEntry();
176 DCHECK(entry); 177 DCHECK(entry);
177 controller().Reload(false); 178 controller().Reload(false);
178 static_cast<TestRenderViewHost*>( 179 static_cast<TestRenderViewHost*>(
179 rvh())->SendNavigate(entry->GetPageID(), entry->GetURL()); 180 rvh())->SendNavigate(entry->GetPageID(), entry->GetURL());
180 } 181 }
181 182
182 void RenderViewHostTestHarness::SetUp() { 183 void RenderViewHostTestHarness::SetUp() {
183 #if defined(USE_AURA) 184 #if defined(USE_AURA)
184 root_window_.reset(new aura::RootWindow); 185 root_window_.reset(aura::MonitorManager::CreateRootWindowForPrimaryMonitor());
185 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get())); 186 gfx::Screen::SetInstance(new aura::TestScreen(root_window_.get()));
186 test_stacking_client_.reset( 187 test_stacking_client_.reset(
187 new aura::test::TestStackingClient(root_window_.get())); 188 new aura::test::TestStackingClient(root_window_.get()));
188 #endif 189 #endif
189 SetContents(CreateTestTabContents()); 190 SetContents(CreateTestTabContents());
190 } 191 }
191 192
192 void RenderViewHostTestHarness::TearDown() { 193 void RenderViewHostTestHarness::TearDown() {
193 SetContents(NULL); 194 SetContents(NULL);
194 #if defined(USE_AURA) 195 #if defined(USE_AURA)
195 test_stacking_client_.reset(); 196 test_stacking_client_.reset();
196 root_window_.reset(); 197 root_window_.reset();
197 #endif 198 #endif
198 199
199 // Make sure that we flush any messages related to TabContents destruction 200 // Make sure that we flush any messages related to TabContents destruction
200 // before we destroy the browser context. 201 // before we destroy the browser context.
201 MessageLoop::current()->RunAllPending(); 202 MessageLoop::current()->RunAllPending();
202 203
203 // Release the browser context on the UI thread. 204 // Release the browser context on the UI thread.
204 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); 205 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release());
205 message_loop_.RunAllPending(); 206 message_loop_.RunAllPending();
206 } 207 }
207 208
208 void RenderViewHostTestHarness::SetRenderProcessHostFactory( 209 void RenderViewHostTestHarness::SetRenderProcessHostFactory(
209 RenderProcessHostFactory* factory) { 210 RenderProcessHostFactory* factory) {
210 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory); 211 rvh_test_enabler_.rvh_factory_->set_render_process_host_factory(factory);
211 } 212 }
212 213
213 } // namespace content 214 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/base/browser_with_test_window_test.cc ('k') | ui/aura/demo/demo_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698