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 "chrome/test/base/browser_with_test_window_test.h" | 5 #include "chrome/test/base/browser_with_test_window_test.h" |
6 | 6 |
7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
8 #include "chrome/browser/profiles/profile_destroyer.h" | 8 #include "chrome/browser/profiles/profile_destroyer.h" |
9 #include "chrome/browser/ui/browser_navigator.h" | 9 #include "chrome/browser/ui/browser_navigator.h" |
| 10 #include "chrome/browser/ui/browser_tabstrip.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
13 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
14 #include "content/public/browser/navigation_controller.h" | 15 #include "content/public/browser/navigation_controller.h" |
15 #include "content/public/browser/navigation_entry.h" | 16 #include "content/public/browser/navigation_entry.h" |
16 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
17 #include "content/public/common/page_transition_types.h" | 18 #include "content/public/common/page_transition_types.h" |
18 #include "content/public/test/test_renderer_host.h" | 19 #include "content/public/test/test_renderer_host.h" |
19 | 20 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 131 |
131 void BrowserWithTestWindowTest::NavigateAndCommit( | 132 void BrowserWithTestWindowTest::NavigateAndCommit( |
132 NavigationController* controller, | 133 NavigationController* controller, |
133 const GURL& url) { | 134 const GURL& url) { |
134 controller->LoadURL( | 135 controller->LoadURL( |
135 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); | 136 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); |
136 CommitPendingLoad(controller); | 137 CommitPendingLoad(controller); |
137 } | 138 } |
138 | 139 |
139 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { | 140 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { |
140 NavigateAndCommit(&browser()->GetActiveWebContents()->GetController(), url); | 141 NavigateAndCommit(&chrome::GetActiveWebContents(browser())->GetController(), |
| 142 url); |
141 } | 143 } |
142 | 144 |
143 void BrowserWithTestWindowTest::DestroyBrowserAndProfile() { | 145 void BrowserWithTestWindowTest::DestroyBrowserAndProfile() { |
144 if (browser_.get()) { | 146 if (browser_.get()) { |
145 // Make sure we close all tabs, otherwise Browser isn't happy in its | 147 // Make sure we close all tabs, otherwise Browser isn't happy in its |
146 // destructor. | 148 // destructor. |
147 browser()->CloseAllTabs(); | 149 chrome::CloseAllTabs(browser()); |
148 browser_.reset(NULL); | 150 browser_.reset(NULL); |
149 } | 151 } |
150 window_.reset(NULL); | 152 window_.reset(NULL); |
151 // Destroy the profile here - otherwise, if the profile is freed in the | 153 // Destroy the profile here - otherwise, if the profile is freed in the |
152 // destructor, and a test subclass owns a resource that the profile depends | 154 // destructor, and a test subclass owns a resource that the profile depends |
153 // on (such as g_browser_process()->local_state()) there's no way for the | 155 // on (such as g_browser_process()->local_state()) there's no way for the |
154 // subclass to free it after the profile. | 156 // subclass to free it after the profile. |
155 profile_.reset(NULL); | 157 profile_.reset(NULL); |
156 } | 158 } |
157 | 159 |
158 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { | 160 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { |
159 return new TestingProfile(); | 161 return new TestingProfile(); |
160 } | 162 } |
OLD | NEW |