| 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_IN_PROCESS_BROWSER_TEST_H_ | 5 #ifndef CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| 6 #define CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 6 #define CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Returns the autorelease pool in use inside RunTestOnMainThreadLoop(). | 164 // Returns the autorelease pool in use inside RunTestOnMainThreadLoop(). |
| 165 base::mac::ScopedNSAutoreleasePool* AutoreleasePool() const { | 165 base::mac::ScopedNSAutoreleasePool* AutoreleasePool() const { |
| 166 return autorelease_pool_; | 166 return autorelease_pool_; |
| 167 } | 167 } |
| 168 #endif // OS_MACOSX | 168 #endif // OS_MACOSX |
| 169 | 169 |
| 170 void set_exit_when_last_browser_closes(bool value) { | 170 void set_exit_when_last_browser_closes(bool value) { |
| 171 exit_when_last_browser_closes_ = value; | 171 exit_when_last_browser_closes_ = value; |
| 172 } | 172 } |
| 173 | 173 |
| 174 void set_open_about_blank_on_browser_launch(bool value) { | |
| 175 open_about_blank_on_browser_launch_ = value; | |
| 176 } | |
| 177 | |
| 178 // This must be called before RunTestOnMainThreadLoop() to have any effect. | 174 // This must be called before RunTestOnMainThreadLoop() to have any effect. |
| 179 void set_multi_desktop_test(bool multi_desktop_test) { | 175 void set_multi_desktop_test(bool multi_desktop_test) { |
| 180 multi_desktop_test_ = multi_desktop_test; | 176 multi_desktop_test_ = multi_desktop_test; |
| 181 } | 177 } |
| 182 | 178 |
| 183 private: | 179 private: |
| 184 // Creates a user data directory for the test if one is needed. Returns true | 180 // Creates a user data directory for the test if one is needed. Returns true |
| 185 // if successful. | 181 // if successful. |
| 186 virtual bool CreateUserDataDirectory() WARN_UNUSED_RESULT; | 182 virtual bool CreateUserDataDirectory() WARN_UNUSED_RESULT; |
| 187 | 183 |
| 188 // Quits all open browsers and waits until there are no more browsers. | 184 // Quits all open browsers and waits until there are no more browsers. |
| 189 void QuitBrowsers(); | 185 void QuitBrowsers(); |
| 190 | 186 |
| 191 // Prepare command line that will be used to launch the child browser process | 187 // Prepare command line that will be used to launch the child browser process |
| 192 // with an in-process test. | 188 // with an in-process test. |
| 193 void PrepareTestCommandLine(base::CommandLine* command_line); | 189 void PrepareTestCommandLine(base::CommandLine* command_line); |
| 194 | 190 |
| 195 // Browser created from CreateBrowser. | 191 // Browser created from CreateBrowser. |
| 196 Browser* browser_; | 192 Browser* browser_; |
| 197 | 193 |
| 198 // Temporary user data directory. Used only when a user data directory is not | 194 // Temporary user data directory. Used only when a user data directory is not |
| 199 // specified in the command line. | 195 // specified in the command line. |
| 200 base::ScopedTempDir temp_user_data_dir_; | 196 base::ScopedTempDir temp_user_data_dir_; |
| 201 | 197 |
| 202 // True if we should exit the tests after the last browser instance closes. | 198 // True if we should exit the tests after the last browser instance closes. |
| 203 bool exit_when_last_browser_closes_; | 199 bool exit_when_last_browser_closes_; |
| 204 | 200 |
| 205 // True if the about:blank tab should be opened when the browser is launched. | |
| 206 bool open_about_blank_on_browser_launch_; | |
| 207 | |
| 208 // True if this is a multi-desktop test (in which case this browser test will | 201 // True if this is a multi-desktop test (in which case this browser test will |
| 209 // not ensure that Browsers are only created on the tested desktop). | 202 // not ensure that Browsers are only created on the tested desktop). |
| 210 bool multi_desktop_test_; | 203 bool multi_desktop_test_; |
| 211 | 204 |
| 212 #if defined(OS_MACOSX) | 205 #if defined(OS_MACOSX) |
| 213 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; | 206 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; |
| 214 #endif // OS_MACOSX | 207 #endif // OS_MACOSX |
| 215 | 208 |
| 216 #if defined(OS_WIN) | 209 #if defined(OS_WIN) |
| 217 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | 210 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; |
| 218 #endif | 211 #endif |
| 219 }; | 212 }; |
| 220 | 213 |
| 221 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 214 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| OLD | NEW |