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

Side by Side Diff: chrome/test/base/browser_with_test_window_test.cc

Issue 8983012: Get rid of content::NavigationController in cc file and use "using" instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 11 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/test/base/browser_with_test_window_test.h" 5 #include "chrome/test/base/browser_with_test_window_test.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <ole2.h> 8 #include <ole2.h>
9 #endif // defined(OS_WIN) 9 #endif // defined(OS_WIN)
10 10
11 #include "chrome/browser/tabs/tab_strip_model.h" 11 #include "chrome/browser/tabs/tab_strip_model.h"
12 #include "chrome/browser/ui/browser_navigator.h" 12 #include "chrome/browser/ui/browser_navigator.h"
13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
14 #include "chrome/common/render_messages.h" 14 #include "chrome/common/render_messages.h"
15 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
16 #include "content/browser/tab_contents/render_view_host_manager.h" 16 #include "content/browser/tab_contents/render_view_host_manager.h"
17 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/navigation_entry.h" 18 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/public/common/page_transition_types.h" 20 #include "content/public/common/page_transition_types.h"
21 21
22 using content::BrowserThread; 22 using content::BrowserThread;
23 using content::NavigationController;
23 using content::WebContents; 24 using content::WebContents;
24 25
25 BrowserWithTestWindowTest::BrowserWithTestWindowTest() 26 BrowserWithTestWindowTest::BrowserWithTestWindowTest()
26 : ui_thread_(BrowserThread::UI, message_loop()), 27 : ui_thread_(BrowserThread::UI, message_loop()),
27 file_thread_(BrowserThread::FILE, message_loop()), 28 file_thread_(BrowserThread::FILE, message_loop()),
28 rph_factory_(), 29 rph_factory_(),
29 rvh_factory_(&rph_factory_) { 30 rvh_factory_(&rph_factory_) {
30 #if defined(OS_WIN) 31 #if defined(OS_WIN)
31 OleInitialize(NULL); 32 OleInitialize(NULL);
32 #endif 33 #endif
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 66
66 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { 67 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) {
67 browser::NavigateParams params(browser, url, content::PAGE_TRANSITION_TYPED); 68 browser::NavigateParams params(browser, url, content::PAGE_TRANSITION_TYPED);
68 params.tabstrip_index = 0; 69 params.tabstrip_index = 0;
69 params.disposition = NEW_FOREGROUND_TAB; 70 params.disposition = NEW_FOREGROUND_TAB;
70 browser::Navigate(&params); 71 browser::Navigate(&params);
71 CommitPendingLoad(&params.target_contents->web_contents()->GetController()); 72 CommitPendingLoad(&params.target_contents->web_contents()->GetController());
72 } 73 }
73 74
74 void BrowserWithTestWindowTest::CommitPendingLoad( 75 void BrowserWithTestWindowTest::CommitPendingLoad(
75 content::NavigationController* controller) { 76 NavigationController* controller) {
76 if (!controller->GetPendingEntry()) 77 if (!controller->GetPendingEntry())
77 return; // Nothing to commit. 78 return; // Nothing to commit.
78 79
79 TestRenderViewHost* old_rvh = 80 TestRenderViewHost* old_rvh =
80 TestRenderViewHostForTab(controller->GetWebContents()); 81 TestRenderViewHostForTab(controller->GetWebContents());
81 82
82 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>( 83 TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>(
83 controller->GetWebContents()->GetRenderManagerForTesting()-> 84 controller->GetWebContents()->GetRenderManagerForTesting()->
84 pending_render_view_host()); 85 pending_render_view_host());
85 if (pending_rvh) { 86 if (pending_rvh) {
(...skipping 22 matching lines...) Expand all
108 controller->GetPendingEntry()->GetTransitionType()); 109 controller->GetPendingEntry()->GetTransitionType());
109 } 110 }
110 111
111 // Simulate the SwapOut_ACK that fires if you commit a cross-site navigation 112 // Simulate the SwapOut_ACK that fires if you commit a cross-site navigation
112 // without making any network requests. 113 // without making any network requests.
113 if (pending_rvh) 114 if (pending_rvh)
114 old_rvh->OnSwapOutACK(); 115 old_rvh->OnSwapOutACK();
115 } 116 }
116 117
117 void BrowserWithTestWindowTest::NavigateAndCommit( 118 void BrowserWithTestWindowTest::NavigateAndCommit(
118 content::NavigationController* controller, 119 NavigationController* controller,
119 const GURL& url) { 120 const GURL& url) {
120 controller->LoadURL( 121 controller->LoadURL(
121 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 122 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
122 CommitPendingLoad(controller); 123 CommitPendingLoad(controller);
123 } 124 }
124 125
125 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { 126 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) {
126 NavigateAndCommit(&browser()->GetSelectedTabContentsWrapper()-> 127 NavigateAndCommit(&browser()->GetSelectedTabContentsWrapper()->
127 web_contents()->GetController(), url); 128 web_contents()->GetController(), url);
128 } 129 }
129 130
130 void BrowserWithTestWindowTest::DestroyBrowser() { 131 void BrowserWithTestWindowTest::DestroyBrowser() {
131 if (!browser_.get()) 132 if (!browser_.get())
132 return; 133 return;
133 // Make sure we close all tabs, otherwise Browser isn't happy in its 134 // Make sure we close all tabs, otherwise Browser isn't happy in its
134 // destructor. 135 // destructor.
135 browser()->CloseAllTabs(); 136 browser()->CloseAllTabs();
136 browser_.reset(NULL); 137 browser_.reset(NULL);
137 window_.reset(NULL); 138 window_.reset(NULL);
138 } 139 }
139 140
140 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { 141 TestingProfile* BrowserWithTestWindowTest::CreateProfile() {
141 return new TestingProfile(); 142 return new TestingProfile();
142 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/web_ui_unittest.cc ('k') | chrome/test/base/test_html_dialog_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698