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 #ifndef CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ | 5 #ifndef CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ |
6 #define CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ | 6 #define CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/host_desktop.h" | 11 #include "chrome/browser/ui/host_desktop.h" |
12 #include "chrome/test/base/test_browser_window.h" | 12 #include "chrome/test/base/test_browser_window.h" |
13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
14 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
15 #include "content/public/test/test_renderer_host.h" | 15 #include "content/public/test/test_renderer_host.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 #if defined(OS_CHROMEOS) | 18 #if defined(OS_CHROMEOS) |
19 #include "chrome/browser/chromeos/login/user_manager.h" | 19 #include "chrome/browser/chromeos/login/user_manager.h" |
20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 20 #include "chrome/browser/chromeos/settings/cros_settings.h" |
21 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 21 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
22 #endif | 22 #endif |
23 | 23 |
24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 browser_.reset(browser); | 92 browser_.reset(browser); |
93 } | 93 } |
94 Browser* release_browser() WARN_UNUSED_RESULT { | 94 Browser* release_browser() WARN_UNUSED_RESULT { |
95 return browser_.release(); | 95 return browser_.release(); |
96 } | 96 } |
97 | 97 |
98 TestingProfile* profile() const { return profile_.get(); } | 98 TestingProfile* profile() const { return profile_.get(); } |
99 | 99 |
100 TestingProfile* GetProfile() { return profile_.get(); } | 100 TestingProfile* GetProfile() { return profile_.get(); } |
101 | 101 |
102 base::MessageLoop* message_loop() { return &ui_loop_; } | |
103 | |
104 BrowserWindow* release_browser_window() WARN_UNUSED_RESULT { | 102 BrowserWindow* release_browser_window() WARN_UNUSED_RESULT { |
105 return window_.release(); | 103 return window_.release(); |
106 } | 104 } |
107 | 105 |
108 // Adds a tab to |browser| with the given URL and commits the load. | 106 // Adds a tab to |browser| with the given URL and commits the load. |
109 // This is a convenience function. The new tab will be added at index 0. | 107 // This is a convenience function. The new tab will be added at index 0. |
110 void AddTab(Browser* browser, const GURL& url); | 108 void AddTab(Browser* browser, const GURL& url); |
111 | 109 |
112 // Commits the pending load on the given controller. It will keep the | 110 // Commits the pending load on the given controller. It will keep the |
113 // URL of the pending load. If there is no pending load, this does nothing. | 111 // URL of the pending load. If there is no pending load, this does nothing. |
(...skipping 21 matching lines...) Expand all Loading... |
135 | 133 |
136 // Creates the profile used by this test. The caller owns the return value. | 134 // Creates the profile used by this test. The caller owns the return value. |
137 virtual TestingProfile* CreateProfile(); | 135 virtual TestingProfile* CreateProfile(); |
138 | 136 |
139 // Creates the BrowserWindow used by this test. The caller owns the return | 137 // Creates the BrowserWindow used by this test. The caller owns the return |
140 // value. Can return NULL to use the default window created by Browser. | 138 // value. Can return NULL to use the default window created by Browser. |
141 virtual BrowserWindow* CreateBrowserWindow(); | 139 virtual BrowserWindow* CreateBrowserWindow(); |
142 | 140 |
143 private: | 141 private: |
144 // We need to create a MessageLoop, otherwise a bunch of things fails. | 142 // We need to create a MessageLoop, otherwise a bunch of things fails. |
145 base::MessageLoopForUI ui_loop_; | 143 content::TestBrowserThreadBundle thread_bundle_; |
146 base::ShadowingAtExitManager at_exit_manager_; | 144 base::ShadowingAtExitManager at_exit_manager_; |
147 content::TestBrowserThread ui_thread_; | |
148 content::TestBrowserThread db_thread_; | |
149 content::TestBrowserThread file_thread_; | |
150 content::TestBrowserThread file_user_blocking_thread_; | |
151 | 145 |
152 #if defined(OS_CHROMEOS) | 146 #if defined(OS_CHROMEOS) |
153 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 147 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
154 chromeos::ScopedTestCrosSettings test_cros_settings_; | 148 chromeos::ScopedTestCrosSettings test_cros_settings_; |
155 chromeos::ScopedTestUserManager test_user_manager_; | 149 chromeos::ScopedTestUserManager test_user_manager_; |
156 #endif | 150 #endif |
157 | 151 |
158 scoped_ptr<TestingProfile> profile_; | 152 scoped_ptr<TestingProfile> profile_; |
159 scoped_ptr<BrowserWindow> window_; // Usually a TestBrowserWindow. | 153 scoped_ptr<BrowserWindow> window_; // Usually a TestBrowserWindow. |
160 scoped_ptr<Browser> browser_; | 154 scoped_ptr<Browser> browser_; |
(...skipping 13 matching lines...) Expand all Loading... |
174 ui::ScopedOleInitializer ole_initializer_; | 168 ui::ScopedOleInitializer ole_initializer_; |
175 #endif | 169 #endif |
176 | 170 |
177 // The desktop to create the initial window on. | 171 // The desktop to create the initial window on. |
178 chrome::HostDesktopType host_desktop_type_; | 172 chrome::HostDesktopType host_desktop_type_; |
179 | 173 |
180 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest); | 174 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest); |
181 }; | 175 }; |
182 | 176 |
183 #endif // CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ | 177 #endif // CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ |
OLD | NEW |