| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Creates a BrowserWithTestWindowTest for which the initial window will be | 65 // Creates a BrowserWithTestWindowTest for which the initial window will be |
| 66 // created on the desktop of type |host_desktop_type|. | 66 // created on the desktop of type |host_desktop_type|. |
| 67 explicit BrowserWithTestWindowTest(chrome::HostDesktopType host_desktop_type); | 67 explicit BrowserWithTestWindowTest(chrome::HostDesktopType host_desktop_type); |
| 68 | 68 |
| 69 virtual ~BrowserWithTestWindowTest(); | 69 virtual ~BrowserWithTestWindowTest(); |
| 70 | 70 |
| 71 virtual void SetUp() OVERRIDE; | 71 virtual void SetUp() OVERRIDE; |
| 72 virtual void TearDown() OVERRIDE; | 72 virtual void TearDown() OVERRIDE; |
| 73 | 73 |
| 74 protected: | 74 protected: |
| 75 TestBrowserWindow* window() const { return window_.get(); } | 75 BrowserWindow* window() const { return window_.get(); } |
| 76 void set_window(TestBrowserWindow* window) { | 76 void set_window(BrowserWindow* window) { |
| 77 window_.reset(window); | 77 window_.reset(window); |
| 78 } | 78 } |
| 79 | 79 |
| 80 Browser* browser() const { return browser_.get(); } | 80 Browser* browser() const { return browser_.get(); } |
| 81 void set_browser(Browser* browser) { | 81 void set_browser(Browser* browser) { |
| 82 browser_.reset(browser); | 82 browser_.reset(browser); |
| 83 } | 83 } |
| 84 Browser* release_browser() WARN_UNUSED_RESULT { |
| 85 return browser_.release(); |
| 86 } |
| 84 | 87 |
| 85 TestingProfile* profile() const { return profile_.get(); } | 88 TestingProfile* profile() const { return profile_.get(); } |
| 86 void set_profile(TestingProfile* profile); | 89 void set_profile(TestingProfile* profile); |
| 87 | 90 |
| 88 MessageLoop* message_loop() { return &ui_loop_; } | 91 MessageLoop* message_loop() { return &ui_loop_; } |
| 89 | 92 |
| 90 // Adds a tab to |browser| with the given URL and commits the load. | 93 // Adds a tab to |browser| with the given URL and commits the load. |
| 91 // This is a convenience function. The new tab will be added at index 0. | 94 // This is a convenience function. The new tab will be added at index 0. |
| 92 void AddTab(Browser* browser, const GURL& url); | 95 void AddTab(Browser* browser, const GURL& url); |
| 93 | 96 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 122 private: | 125 private: |
| 123 // We need to create a MessageLoop, otherwise a bunch of things fails. | 126 // We need to create a MessageLoop, otherwise a bunch of things fails. |
| 124 MessageLoopForUI ui_loop_; | 127 MessageLoopForUI ui_loop_; |
| 125 base::ShadowingAtExitManager at_exit_manager_; | 128 base::ShadowingAtExitManager at_exit_manager_; |
| 126 content::TestBrowserThread ui_thread_; | 129 content::TestBrowserThread ui_thread_; |
| 127 content::TestBrowserThread db_thread_; | 130 content::TestBrowserThread db_thread_; |
| 128 content::TestBrowserThread file_thread_; | 131 content::TestBrowserThread file_thread_; |
| 129 content::TestBrowserThread file_user_blocking_thread_; | 132 content::TestBrowserThread file_user_blocking_thread_; |
| 130 | 133 |
| 131 scoped_ptr<TestingProfile> profile_; | 134 scoped_ptr<TestingProfile> profile_; |
| 132 scoped_ptr<TestBrowserWindow> window_; | 135 scoped_ptr<BrowserWindow> window_; // Usually a TestBrowserWindow. |
| 133 scoped_ptr<Browser> browser_; | 136 scoped_ptr<Browser> browser_; |
| 134 | 137 |
| 135 // The existence of this object enables tests via | 138 // The existence of this object enables tests via |
| 136 // RenderViewHostTester. | 139 // RenderViewHostTester. |
| 137 content::RenderViewHostTestEnabler rvh_test_enabler_; | 140 content::RenderViewHostTestEnabler rvh_test_enabler_; |
| 138 | 141 |
| 139 #if defined(USE_AURA) | 142 #if defined(USE_AURA) |
| 140 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 143 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
| 141 #endif | 144 #endif |
| 142 | 145 |
| 143 #if defined(OS_WIN) | 146 #if defined(OS_WIN) |
| 144 ui::ScopedOleInitializer ole_initializer_; | 147 ui::ScopedOleInitializer ole_initializer_; |
| 145 #endif | 148 #endif |
| 146 | 149 |
| 147 // The desktop to create the initial window on. | 150 // The desktop to create the initial window on. |
| 148 chrome::HostDesktopType host_desktop_type_; | 151 chrome::HostDesktopType host_desktop_type_; |
| 149 | 152 |
| 150 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest); | 153 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest); |
| 151 }; | 154 }; |
| 152 | 155 |
| 153 #endif // CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ | 156 #endif // CHROME_TEST_BASE_BROWSER_WITH_TEST_WINDOW_TEST_H_ |
| OLD | NEW |