| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/host_desktop.h" | |
| 14 #include "chrome/test/base/test_browser_window.h" | 13 #include "chrome/test/base/test_browser_window.h" |
| 15 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
| 16 #include "content/public/test/test_browser_thread_bundle.h" | 15 #include "content/public/test/test_browser_thread_bundle.h" |
| 17 #include "content/public/test/test_renderer_host.h" | 16 #include "content/public/test/test_renderer_host.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 18 |
| 20 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
| 21 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 20 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
| 22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 23 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 22 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // Subclasses must invoke BrowserWithTestWindowTest::SetUp as it is responsible | 68 // Subclasses must invoke BrowserWithTestWindowTest::SetUp as it is responsible |
| 70 // for creating the various objects of this class. | 69 // for creating the various objects of this class. |
| 71 class BrowserWithTestWindowTest : public testing::Test { | 70 class BrowserWithTestWindowTest : public testing::Test { |
| 72 public: | 71 public: |
| 73 // Creates a BrowserWithTestWindowTest for which the initial window will be | 72 // Creates a BrowserWithTestWindowTest for which the initial window will be |
| 74 // a tabbed browser created on the native desktop, which is not a hosted app. | 73 // a tabbed browser created on the native desktop, which is not a hosted app. |
| 75 BrowserWithTestWindowTest(); | 74 BrowserWithTestWindowTest(); |
| 76 | 75 |
| 77 // Creates a BrowserWithTestWindowTest for which the initial window will be | 76 // Creates a BrowserWithTestWindowTest for which the initial window will be |
| 78 // the specified type. | 77 // the specified type. |
| 79 BrowserWithTestWindowTest(Browser::Type browser_type, | 78 BrowserWithTestWindowTest(Browser::Type browser_type, bool hosted_app); |
| 80 chrome::HostDesktopType host_desktop_type, | |
| 81 bool hosted_app); | |
| 82 | 79 |
| 83 ~BrowserWithTestWindowTest() override; | 80 ~BrowserWithTestWindowTest() override; |
| 84 | 81 |
| 85 void SetUp() override; | 82 void SetUp() override; |
| 86 void TearDown() override; | 83 void TearDown() override; |
| 87 | 84 |
| 88 protected: | 85 protected: |
| 89 BrowserWindow* window() const { return window_.get(); } | 86 BrowserWindow* window() const { return window_.get(); } |
| 90 | 87 |
| 91 Browser* browser() const { return browser_.get(); } | 88 Browser* browser() const { return browser_.get(); } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // 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. |
| 138 virtual TestingProfile* CreateProfile(); | 135 virtual TestingProfile* CreateProfile(); |
| 139 | 136 |
| 140 // Destroys the profile which was created through |CreateProfile|. | 137 // Destroys the profile which was created through |CreateProfile|. |
| 141 virtual void DestroyProfile(TestingProfile* profile); | 138 virtual void DestroyProfile(TestingProfile* profile); |
| 142 | 139 |
| 143 // Creates the BrowserWindow used by this test. The caller owns the return | 140 // Creates the BrowserWindow used by this test. The caller owns the return |
| 144 // value. Can return NULL to use the default window created by Browser. | 141 // value. Can return NULL to use the default window created by Browser. |
| 145 virtual BrowserWindow* CreateBrowserWindow(); | 142 virtual BrowserWindow* CreateBrowserWindow(); |
| 146 | 143 |
| 147 // Creates the browser given |profile|, |browser_type|, |hosted_app|, | 144 // Creates the browser given |profile|, |browser_type|, |hosted_app|, and |
| 148 // |host_desktop_type| and |browser_window|. The caller owns the return value. | 145 // |browser_window|. The caller owns the return value. |
| 149 virtual Browser* CreateBrowser(Profile* profile, | 146 virtual Browser* CreateBrowser(Profile* profile, |
| 150 Browser::Type browser_type, | 147 Browser::Type browser_type, |
| 151 bool hosted_app, | 148 bool hosted_app, |
| 152 chrome::HostDesktopType host_desktop_type, | |
| 153 BrowserWindow* browser_window); | 149 BrowserWindow* browser_window); |
| 154 | 150 |
| 155 private: | 151 private: |
| 156 // We need to create a MessageLoop, otherwise a bunch of things fails. | 152 // We need to create a MessageLoop, otherwise a bunch of things fails. |
| 157 content::TestBrowserThreadBundle thread_bundle_; | 153 content::TestBrowserThreadBundle thread_bundle_; |
| 158 base::ShadowingAtExitManager at_exit_manager_; | 154 base::ShadowingAtExitManager at_exit_manager_; |
| 159 | 155 |
| 160 #if defined(OS_CHROMEOS) | 156 #if defined(OS_CHROMEOS) |
| 161 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 157 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 162 chromeos::ScopedTestCrosSettings test_cros_settings_; | 158 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 180 scoped_ptr<views::ScopedViewsTestHelper> views_test_helper_; | 176 scoped_ptr<views::ScopedViewsTestHelper> views_test_helper_; |
| 181 #endif | 177 #endif |
| 182 | 178 |
| 183 #if defined(OS_WIN) | 179 #if defined(OS_WIN) |
| 184 ui::ScopedOleInitializer ole_initializer_; | 180 ui::ScopedOleInitializer ole_initializer_; |
| 185 #endif | 181 #endif |
| 186 | 182 |
| 187 // The type of browser to create (tabbed or popup). | 183 // The type of browser to create (tabbed or popup). |
| 188 Browser::Type browser_type_; | 184 Browser::Type browser_type_; |
| 189 | 185 |
| 190 // The desktop to create the initial window on. | |
| 191 chrome::HostDesktopType host_desktop_type_; | |
| 192 | |
| 193 // Whether the browser is part of a hosted app. | 186 // Whether the browser is part of a hosted app. |
| 194 bool hosted_app_; | 187 bool hosted_app_; |
| 195 | 188 |
| 196 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest); | 189 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest); |
| 197 }; | 190 }; |
| 198 | 191 |
| 199 #endif // CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ | 192 #endif // CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ |
| OLD | NEW |