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