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_TEST_BROWSER_WINDOW_H_ | 5 #ifndef CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_ |
6 #define CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_ | 6 #define CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/download/test_download_shelf.h" | 11 #include "chrome/browser/download/test_download_shelf.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/location_bar/location_bar.h" | 14 #include "chrome/browser/ui/location_bar/location_bar.h" |
15 | 15 |
16 #if defined(USE_AURA) | |
17 #include "ui/aura/window.h" | |
18 #endif | |
19 | |
16 class LocationBarTesting; | 20 class LocationBarTesting; |
17 class OmniboxView; | 21 class OmniboxView; |
18 | 22 |
19 namespace extensions { | 23 namespace extensions { |
20 class Extension; | 24 class Extension; |
21 } | 25 } |
22 | 26 |
23 // An implementation of BrowserWindow used for testing. TestBrowserWindow only | 27 // An implementation of BrowserWindow used for testing. TestBrowserWindow only |
24 // contains a valid LocationBar, all other getters return NULL. | 28 // contains a valid LocationBar, all other getters return NULL. |
25 // See BrowserWithTestWindowTest for an example of using this class. | 29 // See BrowserWithTestWindowTest for an example of using this class. |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 private: | 189 private: |
186 DISALLOW_COPY_AND_ASSIGN(TestLocationBar); | 190 DISALLOW_COPY_AND_ASSIGN(TestLocationBar); |
187 }; | 191 }; |
188 | 192 |
189 TestDownloadShelf download_shelf_; | 193 TestDownloadShelf download_shelf_; |
190 TestLocationBar location_bar_; | 194 TestLocationBar location_bar_; |
191 | 195 |
192 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindow); | 196 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindow); |
193 }; | 197 }; |
194 | 198 |
199 #if defined(USE_AURA) | |
200 // A browser window proxy with an associated Aura native window. | |
201 class TestBrowserWindowAura : public TestBrowserWindow { | |
202 public: | |
203 explicit TestBrowserWindowAura(scoped_ptr<aura::Window> native_window); | |
204 ~TestBrowserWindowAura() override; | |
205 | |
206 // TestBrowserWindow overrides: | |
207 gfx::NativeWindow GetNativeWindow() const override; | |
208 void Show() override; | |
209 void Hide() override; | |
210 gfx::Rect GetBounds() const override; | |
211 | |
212 scoped_ptr<Browser> CreateBrowser(const Browser::CreateParams& params); | |
213 | |
214 private: | |
215 Browser* browser_; // not owned | |
216 scoped_ptr<aura::Window> native_window_; | |
217 | |
218 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowAura); | |
219 }; | |
220 #endif // defined(USE_AURA) | |
221 | |
195 namespace chrome { | 222 namespace chrome { |
196 | 223 |
197 // Helper that handle the lifetime of TestBrowserWindow instances. | 224 // Helper that handle the lifetime of TestBrowserWindow instances. |
198 Browser* CreateBrowserWithTestWindowForParams(Browser::CreateParams* params); | 225 scoped_ptr<Browser> CreateBrowserWithTestWindowForParams( |
xdai1
2015/07/08 21:34:21
For consistency, also made CreateBrowserWithTestWi
| |
226 Browser::CreateParams* params); | |
227 | |
228 #if defined(USE_AURA) | |
229 // Helper that creates a browser which has a native aura window. It also handles | |
230 // the lifetime of TestBrowserWindowAura. | |
231 scoped_ptr<Browser> CreateBrowserWithAuraTestWindowForParams( | |
232 const Browser::CreateParams& params); | |
233 | |
234 // Helper that creates a browser for a native aura window. It also handles the | |
235 // lifetime of TestBrowserWindowAura. | |
236 scoped_ptr<Browser> CreateBrowserForAuraTestWindowAndParams( | |
237 scoped_ptr<aura::Window> window, | |
238 const Browser::CreateParams& params); | |
239 | |
240 #endif // defined(USE_AURA) | |
199 | 241 |
200 } // namespace chrome | 242 } // namespace chrome |
201 | 243 |
202 #endif // CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_ | 244 #endif // CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_ |
OLD | NEW |