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" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // to the Mac. | 166 // to the Mac. |
167 CommandLine GetCommandLineForRelaunch(); | 167 CommandLine GetCommandLineForRelaunch(); |
168 #endif | 168 #endif |
169 | 169 |
170 // Returns the host resolver being used for the tests. Subclasses might want | 170 // Returns the host resolver being used for the tests. Subclasses might want |
171 // to configure it inside tests. | 171 // to configure it inside tests. |
172 net::RuleBasedHostResolverProc* host_resolver() { | 172 net::RuleBasedHostResolverProc* host_resolver() { |
173 return host_resolver_.get(); | 173 return host_resolver_.get(); |
174 } | 174 } |
175 | 175 |
176 // Sets some test states (see below for comments). Call this in your test | |
177 // constructor. | |
178 void EnableDOMAutomation() { dom_automation_enabled_ = true; } | |
179 #if defined(OS_POSIX) | 176 #if defined(OS_POSIX) |
180 // This is only needed by a test that raises SIGTERM to ensure that a specific | 177 // This is only needed by a test that raises SIGTERM to ensure that a specific |
181 // codepath is taken. | 178 // codepath is taken. |
182 void DisableSIGTERMHandling() { | 179 void DisableSIGTERMHandling() { |
183 handle_sigterm_ = false; | 180 handle_sigterm_ = false; |
184 } | 181 } |
185 #endif | 182 #endif |
186 | 183 |
187 #if defined(OS_MACOSX) | 184 #if defined(OS_MACOSX) |
188 // Returns the autorelease pool in use inside RunTestOnMainThreadLoop(). | 185 // Returns the autorelease pool in use inside RunTestOnMainThreadLoop(). |
(...skipping 16 matching lines...) Expand all Loading... |
205 | 202 |
206 // Browser created from CreateBrowser. | 203 // Browser created from CreateBrowser. |
207 Browser* browser_; | 204 Browser* browser_; |
208 | 205 |
209 // Testing server, started on demand. | 206 // Testing server, started on demand. |
210 scoped_ptr<net::TestServer> test_server_; | 207 scoped_ptr<net::TestServer> test_server_; |
211 | 208 |
212 // ContentRendererClient when running in single-process mode. | 209 // ContentRendererClient when running in single-process mode. |
213 scoped_ptr<content::ContentRendererClient> single_process_renderer_client_; | 210 scoped_ptr<content::ContentRendererClient> single_process_renderer_client_; |
214 | 211 |
215 // Whether the JavaScript can access the DOMAutomationController (a JS object | |
216 // that can send messages back to the browser). | |
217 bool dom_automation_enabled_; | |
218 | |
219 // Host resolver to use during the test. | 212 // Host resolver to use during the test. |
220 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_; | 213 scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_; |
221 | 214 |
222 // Temporary user data directory. Used only when a user data directory is not | 215 // Temporary user data directory. Used only when a user data directory is not |
223 // specified in the command line. | 216 // specified in the command line. |
224 ScopedTempDir temp_user_data_dir_; | 217 ScopedTempDir temp_user_data_dir_; |
225 | 218 |
226 #if defined(OS_POSIX) | 219 #if defined(OS_POSIX) |
227 bool handle_sigterm_; | 220 bool handle_sigterm_; |
228 #endif | 221 #endif |
229 | 222 |
230 #if defined(OS_CHROMEOS) | 223 #if defined(OS_CHROMEOS) |
231 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; | 224 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; |
232 #endif // defined(OS_CHROMEOS) | 225 #endif // defined(OS_CHROMEOS) |
233 | 226 |
234 #if defined(OS_MACOSX) | 227 #if defined(OS_MACOSX) |
235 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; | 228 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; |
236 #endif // OS_MACOSX | 229 #endif // OS_MACOSX |
237 }; | 230 }; |
238 | 231 |
239 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 232 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
OLD | NEW |