Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2227)

Side by Side Diff: chrome/test/base/in_process_browser_test.h

Issue 196413016: Move CommandLine to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/automation/proxy_launcher.h ('k') | chrome/test/base/test_launcher_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.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/public/test/browser_test_base.h" 14 #include "content/public/test/browser_test_base.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace base { 17 namespace base {
18
19 class CommandLine;
20
18 #if defined(OS_MACOSX) 21 #if defined(OS_MACOSX)
19 namespace mac { 22 namespace mac {
20 class ScopedNSAutoreleasePool; 23 class ScopedNSAutoreleasePool;
21 } // namespace mac 24 } // namespace mac
22 #endif // defined(OS_MACOSX) 25 #endif // defined(OS_MACOSX)
23 26
24 #if defined(OS_WIN) 27 #if defined(OS_WIN)
25 namespace win { 28 namespace win {
26 class ScopedCOMInitializer; 29 class ScopedCOMInitializer;
27 } 30 }
28 #endif // defined(OS_WIN) 31 #endif // defined(OS_WIN)
29 } // namespace base 32 } // namespace base
30 33
31 class Browser; 34 class Browser;
32 class CommandLine;
33 class Profile; 35 class Profile;
34 36
35 namespace content { 37 namespace content {
36 class ContentRendererClient; 38 class ContentRendererClient;
37 } 39 }
38 40
39 // Base class for tests wanting to bring up a browser in the unit test process. 41 // Base class for tests wanting to bring up a browser in the unit test process.
40 // Writing tests with InProcessBrowserTest is slightly different than that of 42 // Writing tests with InProcessBrowserTest is slightly different than that of
41 // other tests. This is necessitated by InProcessBrowserTest running a message 43 // other tests. This is necessitated by InProcessBrowserTest running a message
42 // loop. To use InProcessBrowserTest do the following: 44 // loop. To use InProcessBrowserTest do the following:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // the navigation to complete, and show the browser's window. 150 // the navigation to complete, and show the browser's window.
149 void AddBlankTabAndShow(Browser* browser); 151 void AddBlankTabAndShow(Browser* browser);
150 152
151 #if !defined OS_MACOSX 153 #if !defined OS_MACOSX
152 // Return a CommandLine object that is used to relaunch the browser_test 154 // Return a CommandLine object that is used to relaunch the browser_test
153 // binary as a browser process. This function is deliberately not defined on 155 // binary as a browser process. This function is deliberately not defined on
154 // the Mac because re-using an existing browser process when launching from 156 // the Mac because re-using an existing browser process when launching from
155 // the command line isn't a concept that we support on the Mac; AppleEvents 157 // the command line isn't a concept that we support on the Mac; AppleEvents
156 // are the Mac solution for the same need. Any test based on these functions 158 // are the Mac solution for the same need. Any test based on these functions
157 // doesn't apply to the Mac. 159 // doesn't apply to the Mac.
158 CommandLine GetCommandLineForRelaunch(); 160 base::CommandLine GetCommandLineForRelaunch();
159 #endif 161 #endif
160 162
161 #if defined(OS_MACOSX) 163 #if defined(OS_MACOSX)
162 // Returns the autorelease pool in use inside RunTestOnMainThreadLoop(). 164 // Returns the autorelease pool in use inside RunTestOnMainThreadLoop().
163 base::mac::ScopedNSAutoreleasePool* AutoreleasePool() const { 165 base::mac::ScopedNSAutoreleasePool* AutoreleasePool() const {
164 return autorelease_pool_; 166 return autorelease_pool_;
165 } 167 }
166 #endif // OS_MACOSX 168 #endif // OS_MACOSX
167 169
168 void set_exit_when_last_browser_closes(bool value) { 170 void set_exit_when_last_browser_closes(bool value) {
169 exit_when_last_browser_closes_ = value; 171 exit_when_last_browser_closes_ = value;
170 } 172 }
171 173
172 // This must be called before RunTestOnMainThreadLoop() to have any effect. 174 // This must be called before RunTestOnMainThreadLoop() to have any effect.
173 void set_multi_desktop_test(bool multi_desktop_test) { 175 void set_multi_desktop_test(bool multi_desktop_test) {
174 multi_desktop_test_ = multi_desktop_test; 176 multi_desktop_test_ = multi_desktop_test;
175 } 177 }
176 178
177 private: 179 private:
178 // 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
179 // if successful. 181 // if successful.
180 virtual bool CreateUserDataDirectory() WARN_UNUSED_RESULT; 182 virtual bool CreateUserDataDirectory() WARN_UNUSED_RESULT;
181 183
182 // 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.
183 void QuitBrowsers(); 185 void QuitBrowsers();
184 186
185 // 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
186 // with an in-process test. 188 // with an in-process test.
187 void PrepareTestCommandLine(CommandLine* command_line); 189 void PrepareTestCommandLine(base::CommandLine* command_line);
188 190
189 // Browser created from CreateBrowser. 191 // Browser created from CreateBrowser.
190 Browser* browser_; 192 Browser* browser_;
191 193
192 // 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
193 // specified in the command line. 195 // specified in the command line.
194 base::ScopedTempDir temp_user_data_dir_; 196 base::ScopedTempDir temp_user_data_dir_;
195 197
196 // 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.
197 bool exit_when_last_browser_closes_; 199 bool exit_when_last_browser_closes_;
198 200
199 // 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
200 // not ensure that Browsers are only created on the tested desktop). 202 // not ensure that Browsers are only created on the tested desktop).
201 bool multi_desktop_test_; 203 bool multi_desktop_test_;
202 204
203 #if defined(OS_MACOSX) 205 #if defined(OS_MACOSX)
204 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; 206 base::mac::ScopedNSAutoreleasePool* autorelease_pool_;
205 #endif // OS_MACOSX 207 #endif // OS_MACOSX
206 208
207 #if defined(OS_WIN) 209 #if defined(OS_WIN)
208 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; 210 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
209 #endif 211 #endif
210 }; 212 };
211 213
212 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ 214 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_
OLDNEW
« no previous file with comments | « chrome/test/automation/proxy_launcher.h ('k') | chrome/test/base/test_launcher_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698