| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser_with_test_window_test.h" | 5 #include "chrome/test/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/browser.h" | 11 #include "chrome/browser/browser.h" |
| 12 #include "chrome/browser/browser_navigator.h" |
| 12 #include "chrome/browser/tab_contents/navigation_controller.h" | 13 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 13 #include "chrome/browser/tab_contents/navigation_entry.h" | 14 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 14 #include "chrome/browser/tab_contents/tab_contents.h" | 15 #include "chrome/browser/tab_contents/tab_contents.h" |
| 15 #include "chrome/browser/tabs/tab_strip_model.h" | 16 #include "chrome/browser/tabs/tab_strip_model.h" |
| 16 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
| 17 #include "chrome/test/testing_profile.h" | 18 #include "chrome/test/testing_profile.h" |
| 18 | 19 |
| 19 BrowserWithTestWindowTest::BrowserWithTestWindowTest() | 20 BrowserWithTestWindowTest::BrowserWithTestWindowTest() |
| 20 : ui_thread_(BrowserThread::UI, message_loop()), | 21 : ui_thread_(BrowserThread::UI, message_loop()), |
| 21 rph_factory_(), | 22 rph_factory_(), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #endif | 54 #endif |
| 54 } | 55 } |
| 55 | 56 |
| 56 TestRenderViewHost* BrowserWithTestWindowTest::TestRenderViewHostForTab( | 57 TestRenderViewHost* BrowserWithTestWindowTest::TestRenderViewHostForTab( |
| 57 TabContents* tab_contents) { | 58 TabContents* tab_contents) { |
| 58 return static_cast<TestRenderViewHost*>( | 59 return static_cast<TestRenderViewHost*>( |
| 59 tab_contents->render_view_host()); | 60 tab_contents->render_view_host()); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { | 63 void BrowserWithTestWindowTest::AddTab(Browser* browser, const GURL& url) { |
| 63 Browser::AddTabWithURLParams params(url, PageTransition::TYPED); | 64 browser::NavigateParams params(browser, url, PageTransition::TYPED); |
| 64 params.index = 0; | 65 params.tabstrip_index = 0; |
| 65 TabContents* contents = browser->AddTabWithURL(¶ms); | 66 params.disposition = NEW_FOREGROUND_TAB; |
| 66 CommitPendingLoad(&contents->controller()); | 67 browser::Navigate(¶ms); |
| 68 CommitPendingLoad(¶ms.target_contents->controller()); |
| 67 } | 69 } |
| 68 | 70 |
| 69 void BrowserWithTestWindowTest::CommitPendingLoad( | 71 void BrowserWithTestWindowTest::CommitPendingLoad( |
| 70 NavigationController* controller) { | 72 NavigationController* controller) { |
| 71 if (!controller->pending_entry()) | 73 if (!controller->pending_entry()) |
| 72 return; // Nothing to commit. | 74 return; // Nothing to commit. |
| 73 | 75 |
| 74 TestRenderViewHost* test_rvh = | 76 TestRenderViewHost* test_rvh = |
| 75 TestRenderViewHostForTab(controller->tab_contents()); | 77 TestRenderViewHostForTab(controller->tab_contents()); |
| 76 MockRenderProcessHost* mock_rph = static_cast<MockRenderProcessHost*>( | 78 MockRenderProcessHost* mock_rph = static_cast<MockRenderProcessHost*>( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 92 void BrowserWithTestWindowTest::NavigateAndCommit( | 94 void BrowserWithTestWindowTest::NavigateAndCommit( |
| 93 NavigationController* controller, | 95 NavigationController* controller, |
| 94 const GURL& url) { | 96 const GURL& url) { |
| 95 controller->LoadURL(url, GURL(), 0); | 97 controller->LoadURL(url, GURL(), 0); |
| 96 CommitPendingLoad(controller); | 98 CommitPendingLoad(controller); |
| 97 } | 99 } |
| 98 | 100 |
| 99 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { | 101 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { |
| 100 NavigateAndCommit(&browser()->GetSelectedTabContents()->controller(), url); | 102 NavigateAndCommit(&browser()->GetSelectedTabContents()->controller(), url); |
| 101 } | 103 } |
| OLD | NEW |