Chromium Code Reviews| 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 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 Browser* CreateBrowserWithTestWindowForParams(Browser::CreateParams* params); |
| 199 | 226 |
| 227 #if defined(USE_AURA) | |
| 228 // Helper that creates a browser which has a native aura window. It also handles | |
| 229 // the lifetime of TestBrowserWindowAura. | |
| 230 Browser* CreateBrowserWithAuraTestWindowForParams( | |
| 231 const Browser::CreateParams& params); | |
| 232 | |
| 233 // Helper that creates a browser for a native aura window. It also handles the | |
| 234 // lifetime of TestBrowserWindowAura. | |
| 235 Browser* CreateBrowserForAuraTestWindowAndParams( | |
|
msw
2015/07/08 23:58:00
Could we just have this single function, and calle
| |
| 236 scoped_ptr<aura::Window> window, | |
| 237 const Browser::CreateParams& params); | |
| 238 | |
| 239 #endif // defined(USE_AURA) | |
| 240 | |
| 200 } // namespace chrome | 241 } // namespace chrome |
| 201 | 242 |
| 202 #endif // CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_ | 243 #endif // CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_ |
| OLD | NEW |