| 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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
| 12 #include "content/public/common/page_transition_types.h" | 12 #include "content/public/common/page_transition_types.h" |
| 13 #include "content/public/test/browser_test.h" | 13 #include "content/public/test/browser_test.h" |
| 14 #include "content/test/browser_test_base.h" | 14 #include "content/test/browser_test_base.h" |
| 15 #include "net/test/test_server.h" | |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 16 |
| 18 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
| 19 #include "chrome/browser/chromeos/cros/cros_library.h" | 18 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 20 #endif // defined(OS_CHROMEOS) | 19 #endif // defined(OS_CHROMEOS) |
| 21 | 20 |
| 22 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
| 23 namespace base { | 22 namespace base { |
| 24 namespace mac { | 23 namespace mac { |
| 25 class ScopedNSAutoreleasePool; | 24 class ScopedNSAutoreleasePool; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // successful. | 116 // successful. |
| 118 virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT; | 117 virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT; |
| 119 | 118 |
| 120 // Override this to add any custom cleanup code that needs to be done on the | 119 // Override this to add any custom cleanup code that needs to be done on the |
| 121 // main thread before the browser is torn down. | 120 // main thread before the browser is torn down. |
| 122 virtual void CleanUpOnMainThread() {} | 121 virtual void CleanUpOnMainThread() {} |
| 123 | 122 |
| 124 // BrowserTestBase: | 123 // BrowserTestBase: |
| 125 virtual void RunTestOnMainThreadLoop() OVERRIDE; | 124 virtual void RunTestOnMainThreadLoop() OVERRIDE; |
| 126 | 125 |
| 127 // Returns the testing server. Guaranteed to be non-NULL. | |
| 128 const net::TestServer* test_server() const { return test_server_.get(); } | |
| 129 net::TestServer* test_server() { return test_server_.get(); } | |
| 130 | |
| 131 // Creates a browser with a single tab (about:blank), waits for the tab to | 126 // Creates a browser with a single tab (about:blank), waits for the tab to |
| 132 // finish loading and shows the browser. | 127 // finish loading and shows the browser. |
| 133 // | 128 // |
| 134 // This is invoked from Setup. | 129 // This is invoked from Setup. |
| 135 Browser* CreateBrowser(Profile* profile); | 130 Browser* CreateBrowser(Profile* profile); |
| 136 | 131 |
| 137 // Similar to |CreateBrowser|, but creates an incognito browser. | 132 // Similar to |CreateBrowser|, but creates an incognito browser. |
| 138 Browser* CreateIncognitoBrowser(); | 133 Browser* CreateIncognitoBrowser(); |
| 139 | 134 |
| 140 // Creates a browser for a popup window with a single tab (about:blank), waits | 135 // Creates a browser for a popup window with a single tab (about:blank), waits |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // Quits all open browsers and waits until there are no more browsers. | 183 // Quits all open browsers and waits until there are no more browsers. |
| 189 void QuitBrowsers(); | 184 void QuitBrowsers(); |
| 190 | 185 |
| 191 // Prepare command line that will be used to launch the child browser process | 186 // Prepare command line that will be used to launch the child browser process |
| 192 // with an in-process test. | 187 // with an in-process test. |
| 193 void PrepareTestCommandLine(CommandLine* command_line); | 188 void PrepareTestCommandLine(CommandLine* command_line); |
| 194 | 189 |
| 195 // Browser created from CreateBrowser. | 190 // Browser created from CreateBrowser. |
| 196 Browser* browser_; | 191 Browser* browser_; |
| 197 | 192 |
| 198 // Testing server, started on demand. | |
| 199 scoped_ptr<net::TestServer> test_server_; | |
| 200 | |
| 201 // ContentRendererClient when running in single-process mode. | 193 // ContentRendererClient when running in single-process mode. |
| 202 scoped_ptr<content::ContentRendererClient> single_process_renderer_client_; | 194 scoped_ptr<content::ContentRendererClient> single_process_renderer_client_; |
| 203 | 195 |
| 204 // Host resolver to use during the test. | 196 // Host resolver to use during the test. |
| 205 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_; | 197 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_; |
| 206 | 198 |
| 207 // Temporary user data directory. Used only when a user data directory is not | 199 // Temporary user data directory. Used only when a user data directory is not |
| 208 // specified in the command line. | 200 // specified in the command line. |
| 209 ScopedTempDir temp_user_data_dir_; | 201 ScopedTempDir temp_user_data_dir_; |
| 210 | 202 |
| 211 #if defined(OS_POSIX) | 203 #if defined(OS_POSIX) |
| 212 bool handle_sigterm_; | 204 bool handle_sigterm_; |
| 213 #endif | 205 #endif |
| 214 | 206 |
| 215 #if defined(OS_CHROMEOS) | 207 #if defined(OS_CHROMEOS) |
| 216 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; | 208 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; |
| 217 #endif // defined(OS_CHROMEOS) | 209 #endif // defined(OS_CHROMEOS) |
| 218 | 210 |
| 219 #if defined(OS_MACOSX) | 211 #if defined(OS_MACOSX) |
| 220 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; | 212 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; |
| 221 #endif // OS_MACOSX | 213 #endif // OS_MACOSX |
| 222 }; | 214 }; |
| 223 | 215 |
| 224 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 216 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
| OLD | NEW |