| 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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/download/test_download_shelf.h" | |
| 12 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/location_bar/location_bar.h" | 13 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 15 | 14 |
| 15 #if !defined(OS_CHROMEOS) |
| 16 #include "chrome/browser/download/test_download_shelf.h" |
| 17 #endif |
| 18 |
| 16 class LocationBarTesting; | 19 class LocationBarTesting; |
| 17 class OmniboxView; | 20 class OmniboxView; |
| 18 | 21 |
| 19 namespace extensions { | 22 namespace extensions { |
| 20 class Extension; | 23 class Extension; |
| 21 } | 24 } |
| 22 | 25 |
| 23 // An implementation of BrowserWindow used for testing. TestBrowserWindow only | 26 // An implementation of BrowserWindow used for testing. TestBrowserWindow only |
| 24 // contains a valid LocationBar, all other getters return NULL. | 27 // contains a valid LocationBar, all other getters return NULL. |
| 25 // See BrowserWithTestWindowTest for an example of using this class. | 28 // See BrowserWithTestWindowTest for an example of using this class. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 void SaveStateToContents(content::WebContents* contents) override {} | 176 void SaveStateToContents(content::WebContents* contents) override {} |
| 174 void Revert() override {} | 177 void Revert() override {} |
| 175 const OmniboxView* GetOmniboxView() const override; | 178 const OmniboxView* GetOmniboxView() const override; |
| 176 OmniboxView* GetOmniboxView() override; | 179 OmniboxView* GetOmniboxView() override; |
| 177 LocationBarTesting* GetLocationBarForTesting() override; | 180 LocationBarTesting* GetLocationBarForTesting() override; |
| 178 | 181 |
| 179 private: | 182 private: |
| 180 DISALLOW_COPY_AND_ASSIGN(TestLocationBar); | 183 DISALLOW_COPY_AND_ASSIGN(TestLocationBar); |
| 181 }; | 184 }; |
| 182 | 185 |
| 186 #if !defined(OS_CHROMEOS) |
| 183 TestDownloadShelf download_shelf_; | 187 TestDownloadShelf download_shelf_; |
| 188 #endif |
| 184 TestLocationBar location_bar_; | 189 TestLocationBar location_bar_; |
| 185 | 190 |
| 186 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindow); | 191 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindow); |
| 187 }; | 192 }; |
| 188 | 193 |
| 189 // Handles destroying a TestBrowserWindow when the Browser it is attached to is | 194 // Handles destroying a TestBrowserWindow when the Browser it is attached to is |
| 190 // destroyed. | 195 // destroyed. |
| 191 class TestBrowserWindowOwner : public chrome::BrowserListObserver { | 196 class TestBrowserWindowOwner : public chrome::BrowserListObserver { |
| 192 public: | 197 public: |
| 193 explicit TestBrowserWindowOwner(TestBrowserWindow* window); | 198 explicit TestBrowserWindowOwner(TestBrowserWindow* window); |
| 194 ~TestBrowserWindowOwner() override; | 199 ~TestBrowserWindowOwner() override; |
| 195 | 200 |
| 196 private: | 201 private: |
| 197 // Overridden from BrowserListObserver: | 202 // Overridden from BrowserListObserver: |
| 198 void OnBrowserRemoved(Browser* browser) override; | 203 void OnBrowserRemoved(Browser* browser) override; |
| 199 scoped_ptr<TestBrowserWindow> window_; | 204 scoped_ptr<TestBrowserWindow> window_; |
| 200 | 205 |
| 201 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowOwner); | 206 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowOwner); |
| 202 }; | 207 }; |
| 203 | 208 |
| 204 namespace chrome { | 209 namespace chrome { |
| 205 | 210 |
| 206 // Helper that handle the lifetime of TestBrowserWindow instances. | 211 // Helper that handle the lifetime of TestBrowserWindow instances. |
| 207 scoped_ptr<Browser> CreateBrowserWithTestWindowForParams( | 212 scoped_ptr<Browser> CreateBrowserWithTestWindowForParams( |
| 208 Browser::CreateParams* params); | 213 Browser::CreateParams* params); |
| 209 | 214 |
| 210 } // namespace chrome | 215 } // namespace chrome |
| 211 | 216 |
| 212 #endif // CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_ | 217 #endif // CHROME_TEST_BASE_TEST_BROWSER_WINDOW_H_ |
| OLD | NEW |