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/chrome_content_browser_client.h" | |
12 #include "chrome/browser/tabs/tab_strip_model.h" | 11 #include "chrome/browser/tabs/tab_strip_model.h" |
13 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_navigator.h" | 13 #include "chrome/browser/ui/browser_navigator.h" |
15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
16 #include "chrome/common/page_transition_types.h" | 15 #include "chrome/common/page_transition_types.h" |
17 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
18 #include "chrome/test/testing_profile.h" | 17 #include "chrome/test/testing_profile.h" |
19 #include "content/browser/tab_contents/navigation_controller.h" | 18 #include "content/browser/tab_contents/navigation_controller.h" |
20 #include "content/browser/tab_contents/navigation_entry.h" | 19 #include "content/browser/tab_contents/navigation_entry.h" |
21 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
22 #include "content/common/content_client.h" | 21 #include "content/common/content_client.h" |
23 | 22 |
24 BrowserWithTestWindowTest::BrowserWithTestWindowTest() | 23 BrowserWithTestWindowTest::BrowserWithTestWindowTest() |
25 : ui_thread_(BrowserThread::UI, message_loop()), | 24 : ui_thread_(BrowserThread::UI, message_loop()), |
26 file_thread_(BrowserThread::FILE, message_loop()), | 25 file_thread_(BrowserThread::FILE, message_loop()), |
27 rph_factory_(), | 26 rph_factory_(), |
28 rvh_factory_(&rph_factory_) { | 27 rvh_factory_(&rph_factory_) { |
29 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
30 OleInitialize(NULL); | 29 OleInitialize(NULL); |
31 #endif | 30 #endif |
32 } | 31 } |
33 | 32 |
34 void BrowserWithTestWindowTest::SetUp() { | 33 void BrowserWithTestWindowTest::SetUp() { |
35 TestingBrowserProcessTest::SetUp(); | 34 TestingBrowserProcessTest::SetUp(); |
36 | 35 |
37 // NOTE: I have a feeling we're going to want virtual methods for creating | 36 // NOTE: I have a feeling we're going to want virtual methods for creating |
38 // these, as such they're in SetUp instead of the constructor. | 37 // these, as such they're in SetUp instead of the constructor. |
39 profile_.reset(new TestingProfile()); | 38 profile_.reset(new TestingProfile()); |
40 content::GetContentClient()->set_browser_client( | 39 content::GetContentClient()->set_browser_client(&browser_client_); |
41 new chrome::ChromeContentBrowserClient()); | |
42 browser_.reset(new Browser(Browser::TYPE_NORMAL, profile())); | 40 browser_.reset(new Browser(Browser::TYPE_NORMAL, profile())); |
43 window_.reset(new TestBrowserWindow(browser())); | 41 window_.reset(new TestBrowserWindow(browser())); |
44 browser_->set_window(window_.get()); | 42 browser_->set_window(window_.get()); |
45 } | 43 } |
46 | 44 |
47 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { | 45 BrowserWithTestWindowTest::~BrowserWithTestWindowTest() { |
48 // Make sure we close all tabs, otherwise Browser isn't happy in its | 46 // Make sure we close all tabs, otherwise Browser isn't happy in its |
49 // destructor. | 47 // destructor. |
50 browser()->CloseAllTabs(); | 48 browser()->CloseAllTabs(); |
51 | 49 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void BrowserWithTestWindowTest::NavigateAndCommit( | 101 void BrowserWithTestWindowTest::NavigateAndCommit( |
104 NavigationController* controller, | 102 NavigationController* controller, |
105 const GURL& url) { | 103 const GURL& url) { |
106 controller->LoadURL(url, GURL(), PageTransition::LINK); | 104 controller->LoadURL(url, GURL(), PageTransition::LINK); |
107 CommitPendingLoad(controller); | 105 CommitPendingLoad(controller); |
108 } | 106 } |
109 | 107 |
110 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { | 108 void BrowserWithTestWindowTest::NavigateAndCommitActiveTab(const GURL& url) { |
111 NavigateAndCommit(&browser()->GetSelectedTabContents()->controller(), url); | 109 NavigateAndCommit(&browser()->GetSelectedTabContents()->controller(), url); |
112 } | 110 } |
OLD | NEW |