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