| 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/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "chrome/browser/profiles/profile_destroyer.h" | 8 #include "chrome/browser/profiles/profile_destroyer.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_navigator.h" | 10 #include "chrome/browser/ui/browser_navigator.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" | |
| 18 #include "content/public/test/test_renderer_host.h" | 17 #include "content/public/test/test_renderer_host.h" |
| 18 #include "ui/base/page_transition_types.h" |
| 19 | 19 |
| 20 #if defined(USE_AURA) | 20 #if defined(USE_AURA) |
| 21 #include "ui/aura/test/aura_test_helper.h" | 21 #include "ui/aura/test/aura_test_helper.h" |
| 22 #include "ui/compositor/compositor.h" | 22 #include "ui/compositor/compositor.h" |
| 23 #include "ui/compositor/test/context_factories_for_test.h" | 23 #include "ui/compositor/test/context_factories_for_test.h" |
| 24 #include "ui/wm/core/default_activation_client.h" | 24 #include "ui/wm/core/default_activation_client.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 #if defined(USE_ASH) | 27 #if defined(USE_ASH) |
| 28 #include "ash/test/ash_test_helper.h" | 28 #include "ash/test/ash_test_helper.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 base::MessageLoop::current()->PostTask(FROM_HERE, | 114 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 115 base::MessageLoop::QuitClosure()); | 115 base::MessageLoop::QuitClosure()); |
| 116 base::MessageLoop::current()->Run(); | 116 base::MessageLoop::current()->Run(); |
| 117 | 117 |
| 118 #if defined(TOOLKIT_VIEWS) | 118 #if defined(TOOLKIT_VIEWS) |
| 119 views_delegate_.reset(NULL); | 119 views_delegate_.reset(NULL); |
| 120 #endif | 120 #endif |
| 121 } | 121 } |
| 122 | 122 |
| 123 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { | 123 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { |
| 124 chrome::NavigateParams params(browser, url, content::PAGE_TRANSITION_TYPED); | 124 chrome::NavigateParams params(browser, url, ui::PAGE_TRANSITION_TYPED); |
| 125 params.tabstrip_index = 0; | 125 params.tabstrip_index = 0; |
| 126 params.disposition = NEW_FOREGROUND_TAB; | 126 params.disposition = NEW_FOREGROUND_TAB; |
| 127 chrome::Navigate(¶ms); | 127 chrome::Navigate(¶ms); |
| 128 CommitPendingLoad(¶ms.target_contents->GetController()); | 128 CommitPendingLoad(¶ms.target_contents->GetController()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void BrowserWithTestWindowTest::CommitPendingLoad( | 131 void BrowserWithTestWindowTest::CommitPendingLoad( |
| 132 NavigationController* controller) { | 132 NavigationController* controller) { |
| 133 if (!controller->GetPendingEntry()) | 133 if (!controller->GetPendingEntry()) |
| 134 return; // Nothing to commit. | 134 return; // Nothing to commit. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 GetMaxPageIDForSiteInstance(test_rvh->GetSiteInstance()) + 1, | 167 GetMaxPageIDForSiteInstance(test_rvh->GetSiteInstance()) + 1, |
| 168 controller->GetPendingEntry()->GetURL(), | 168 controller->GetPendingEntry()->GetURL(), |
| 169 controller->GetPendingEntry()->GetTransitionType()); | 169 controller->GetPendingEntry()->GetTransitionType()); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 void BrowserWithTestWindowTest::NavigateAndCommit( | 173 void BrowserWithTestWindowTest::NavigateAndCommit( |
| 174 NavigationController* controller, | 174 NavigationController* controller, |
| 175 const GURL& url) { | 175 const GURL& url) { |
| 176 controller->LoadURL( | 176 controller->LoadURL( |
| 177 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); | 177 url, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 178 CommitPendingLoad(controller); | 178 CommitPendingLoad(controller); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { | 181 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { |
| 182 NavigateAndCommit(&browser()->tab_strip_model()->GetActiveWebContents()-> | 182 NavigateAndCommit(&browser()->tab_strip_model()->GetActiveWebContents()-> |
| 183 GetController(), | 183 GetController(), |
| 184 url); | 184 url); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void BrowserWithTestWindowTest::NavigateAndCommitActiveTabWithTitle( | 187 void BrowserWithTestWindowTest::NavigateAndCommitActiveTabWithTitle( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 245 |
| 246 #if !defined(OS_CHROMEOS) && defined(TOOLKIT_VIEWS) | 246 #if !defined(OS_CHROMEOS) && defined(TOOLKIT_VIEWS) |
| 247 views::ViewsDelegate* BrowserWithTestWindowTest::CreateViewsDelegate() { | 247 views::ViewsDelegate* BrowserWithTestWindowTest::CreateViewsDelegate() { |
| 248 #if defined(USE_ASH) | 248 #if defined(USE_ASH) |
| 249 return new ash::test::AshTestViewsDelegate; | 249 return new ash::test::AshTestViewsDelegate; |
| 250 #else | 250 #else |
| 251 return new views::TestViewsDelegate; | 251 return new views::TestViewsDelegate; |
| 252 #endif | 252 #endif |
| 253 } | 253 } |
| 254 #endif | 254 #endif |
| OLD | NEW |