| 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/browser_tabstrip.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 void BrowserWithTestWindowTest::set_profile(TestingProfile* profile) { | 76 void BrowserWithTestWindowTest::set_profile(TestingProfile* profile) { |
| 77 if (profile_.get() != NULL) | 77 if (profile_.get() != NULL) |
| 78 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_.release()); | 78 ProfileDestroyer::DestroyProfileWhenAppropriate(profile_.release()); |
| 79 | 79 |
| 80 profile_.reset(profile); | 80 profile_.reset(profile); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { | 83 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { |
| 84 browser::NavigateParams params(browser, url, content::PAGE_TRANSITION_TYPED); | 84 chrome::NavigateParams params(browser, url, content::PAGE_TRANSITION_TYPED); |
| 85 params.tabstrip_index = 0; | 85 params.tabstrip_index = 0; |
| 86 params.disposition = NEW_FOREGROUND_TAB; | 86 params.disposition = NEW_FOREGROUND_TAB; |
| 87 browser::Navigate(¶ms); | 87 chrome::Navigate(¶ms); |
| 88 CommitPendingLoad(¶ms.target_contents->web_contents()->GetController()); | 88 CommitPendingLoad(¶ms.target_contents->web_contents()->GetController()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void BrowserWithTestWindowTest::CommitPendingLoad( | 91 void BrowserWithTestWindowTest::CommitPendingLoad( |
| 92 NavigationController* controller) { | 92 NavigationController* controller) { |
| 93 if (!controller->GetPendingEntry()) | 93 if (!controller->GetPendingEntry()) |
| 94 return; // Nothing to commit. | 94 return; // Nothing to commit. |
| 95 | 95 |
| 96 RenderViewHost* old_rvh = | 96 RenderViewHost* old_rvh = |
| 97 controller->GetWebContents()->GetRenderViewHost(); | 97 controller->GetWebContents()->GetRenderViewHost(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // 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 |
| 154 // 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 |
| 155 // 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 |
| 156 // subclass to free it after the profile. | 156 // subclass to free it after the profile. |
| 157 profile_.reset(NULL); | 157 profile_.reset(NULL); |
| 158 } | 158 } |
| 159 | 159 |
| 160 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { | 160 TestingProfile* BrowserWithTestWindowTest::CreateProfile() { |
| 161 return new TestingProfile(); | 161 return new TestingProfile(); |
| 162 } | 162 } |
| OLD | NEW |