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

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

Issue 582493002: Enable accessibility testing for the bookmark browser test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applied Feedback Created 5 years, 10 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
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/browser/web_contents.h"
12 #include "content/public/test/browser_test.h" 13 #include "content/public/test/browser_test.h"
13 #include "content/public/test/browser_test_base.h" 14 #include "content/public/test/browser_test_base.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/base/page_transition_types.h" 16 #include "ui/base/page_transition_types.h"
16 17
17 namespace base { 18 namespace base {
18 19
19 class CommandLine; 20 class CommandLine;
20 21
21 #if defined(OS_MACOSX) 22 #if defined(OS_MACOSX)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 Browser* CreateBrowserForPopup(Profile* profile); 142 Browser* CreateBrowserForPopup(Profile* profile);
142 143
143 // Creates a browser for an application and waits for it to load and shows 144 // Creates a browser for an application and waits for it to load and shows
144 // the browser. 145 // the browser.
145 Browser* CreateBrowserForApp(const std::string& app_name, Profile* profile); 146 Browser* CreateBrowserForApp(const std::string& app_name, Profile* profile);
146 147
147 // Called from the various CreateBrowser methods to add a blank tab, wait for 148 // Called from the various CreateBrowser methods to add a blank tab, wait for
148 // the navigation to complete, and show the browser's window. 149 // the navigation to complete, and show the browser's window.
149 void AddBlankTabAndShow(Browser* browser); 150 void AddBlankTabAndShow(Browser* browser);
150 151
152 // Enables running of accessibility audit for a particular test case.
153 // - Call in test body to enable/disable for one test case.
154 // - Call in SetUpOnMainThread to enable for all test cases.
155 void EnableAccessibilityChecksForTestCase(bool enabled) {
156 run_accessibility_checks_for_test_case_ = enabled;
157 }
158
151 #if !defined OS_MACOSX 159 #if !defined OS_MACOSX
152 // Return a CommandLine object that is used to relaunch the browser_test 160 // 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 161 // 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 162 // 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 163 // 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 164 // are the Mac solution for the same need. Any test based on these functions
157 // doesn't apply to the Mac. 165 // doesn't apply to the Mac.
158 base::CommandLine GetCommandLineForRelaunch(); 166 base::CommandLine GetCommandLineForRelaunch();
159 #endif 167 #endif
160 168
(...skipping 10 matching lines...) Expand all
171 179
172 void set_open_about_blank_on_browser_launch(bool value) { 180 void set_open_about_blank_on_browser_launch(bool value) {
173 open_about_blank_on_browser_launch_ = value; 181 open_about_blank_on_browser_launch_ = value;
174 } 182 }
175 183
176 // This must be called before RunTestOnMainThreadLoop() to have any effect. 184 // This must be called before RunTestOnMainThreadLoop() to have any effect.
177 void set_multi_desktop_test(bool multi_desktop_test) { 185 void set_multi_desktop_test(bool multi_desktop_test) {
178 multi_desktop_test_ = multi_desktop_test; 186 multi_desktop_test_ = multi_desktop_test;
179 } 187 }
180 188
189 // Will run accessibility checks and set an error message if it fails.
Jay Civelli 2015/02/07 01:11:12 Nit: Will run -> Runs
hcarmona 2015/02/07 02:22:12 Done.
190 bool RunAccessibilityChecks(std::string* error_message);
191
181 private: 192 private:
182 // Creates a user data directory for the test if one is needed. Returns true 193 // Creates a user data directory for the test if one is needed. Returns true
183 // if successful. 194 // if successful.
184 virtual bool CreateUserDataDirectory() WARN_UNUSED_RESULT; 195 virtual bool CreateUserDataDirectory() WARN_UNUSED_RESULT;
185 196
186 // Quits all open browsers and waits until there are no more browsers. 197 // Quits all open browsers and waits until there are no more browsers.
187 void QuitBrowsers(); 198 void QuitBrowsers();
188 199
189 // Prepare command line that will be used to launch the child browser process 200 // Prepare command line that will be used to launch the child browser process
190 // with an in-process test. 201 // with an in-process test.
191 void PrepareTestCommandLine(base::CommandLine* command_line); 202 void PrepareTestCommandLine(base::CommandLine* command_line);
192 203
193 // Browser created from CreateBrowser. 204 // Browser created from CreateBrowser.
194 Browser* browser_; 205 Browser* browser_;
195 206
196 // Temporary user data directory. Used only when a user data directory is not 207 // Temporary user data directory. Used only when a user data directory is not
197 // specified in the command line. 208 // specified in the command line.
198 base::ScopedTempDir temp_user_data_dir_; 209 base::ScopedTempDir temp_user_data_dir_;
199 210
200 // True if we should exit the tests after the last browser instance closes. 211 // True if we should exit the tests after the last browser instance closes.
201 bool exit_when_last_browser_closes_; 212 bool exit_when_last_browser_closes_;
202 213
203 // True if the about:blank tab should be opened when the browser is launched. 214 // True if the about:blank tab should be opened when the browser is launched.
204 bool open_about_blank_on_browser_launch_; 215 bool open_about_blank_on_browser_launch_;
205 216
206 // True if this is a multi-desktop test (in which case this browser test will 217 // True if this is a multi-desktop test (in which case this browser test will
207 // not ensure that Browsers are only created on the tested desktop). 218 // not ensure that Browsers are only created on the tested desktop).
208 bool multi_desktop_test_; 219 bool multi_desktop_test_;
209 220
221 // True if the accessibility test should run for a particular test case.
222 // This is reset for every test case.
223 bool run_accessibility_checks_for_test_case_;
224
210 #if defined(OS_MACOSX) 225 #if defined(OS_MACOSX)
211 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; 226 base::mac::ScopedNSAutoreleasePool* autorelease_pool_;
212 #endif // OS_MACOSX 227 #endif // OS_MACOSX
213 228
214 #if defined(OS_WIN) 229 #if defined(OS_WIN)
215 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; 230 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
216 #endif 231 #endif
217 }; 232 };
218 233
219 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ 234 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698