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

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: Update for Review Created 5 years, 11 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"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 Browser* CreateBrowserForPopup(Profile* profile); 141 Browser* CreateBrowserForPopup(Profile* profile);
142 142
143 // Creates a browser for an application and waits for it to load and shows 143 // Creates a browser for an application and waits for it to load and shows
144 // the browser. 144 // the browser.
145 Browser* CreateBrowserForApp(const std::string& app_name, Profile* profile); 145 Browser* CreateBrowserForApp(const std::string& app_name, Profile* profile);
146 146
147 // Called from the various CreateBrowser methods to add a blank tab, wait for 147 // Called from the various CreateBrowser methods to add a blank tab, wait for
148 // the navigation to complete, and show the browser's window. 148 // the navigation to complete, and show the browser's window.
149 void AddBlankTabAndShow(Browser* browser); 149 void AddBlankTabAndShow(Browser* browser);
150 150
151 // Disables running of accessibility tests for a particular test case. This is
Paweł Hajdan Jr. 2015/01/29 13:01:19 Do we really need this somewhat elaborate from API
hcarmona 2015/01/30 22:19:47 This is based on the a11y audit from js: src/chrom
152 // only meaningful when called from IN_PROC_BROWSER_TEST_F to override the
153 // value of run_accessibility_checks_.
154 void DisableAccessibilityChecks();
155
156 // Enables running of accessibility tests for a particular test case. This is
157 // only meaningful when called from IN_PROC_BROWSER_TEST_F to override the
158 // value of run_accessibility_checks_.
159 void EnableAccessibilityChecks();
160
151 #if !defined OS_MACOSX 161 #if !defined OS_MACOSX
152 // Return a CommandLine object that is used to relaunch the browser_test 162 // 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 163 // 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 164 // 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 165 // 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 166 // are the Mac solution for the same need. Any test based on these functions
157 // doesn't apply to the Mac. 167 // doesn't apply to the Mac.
158 base::CommandLine GetCommandLineForRelaunch(); 168 base::CommandLine GetCommandLineForRelaunch();
159 #endif 169 #endif
160 170
(...skipping 10 matching lines...) Expand all
171 181
172 void set_open_about_blank_on_browser_launch(bool value) { 182 void set_open_about_blank_on_browser_launch(bool value) {
173 open_about_blank_on_browser_launch_ = value; 183 open_about_blank_on_browser_launch_ = value;
174 } 184 }
175 185
176 // This must be called before RunTestOnMainThreadLoop() to have any effect. 186 // This must be called before RunTestOnMainThreadLoop() to have any effect.
177 void set_multi_desktop_test(bool multi_desktop_test) { 187 void set_multi_desktop_test(bool multi_desktop_test) {
178 multi_desktop_test_ = multi_desktop_test; 188 multi_desktop_test_ = multi_desktop_test;
179 } 189 }
180 190
191 // This should be called in a sub-class constructor to enable/disable
192 // accessibility testing for all test cases.
193 void set_run_accessibility_checks(bool run_accessibility_checks) {
194 run_accessibility_checks_ = run_accessibility_checks;
195 }
196
181 private: 197 private:
182 // Creates a user data directory for the test if one is needed. Returns true 198 // Creates a user data directory for the test if one is needed. Returns true
183 // if successful. 199 // if successful.
184 virtual bool CreateUserDataDirectory() WARN_UNUSED_RESULT; 200 virtual bool CreateUserDataDirectory() WARN_UNUSED_RESULT;
185 201
186 // Quits all open browsers and waits until there are no more browsers. 202 // Quits all open browsers and waits until there are no more browsers.
187 void QuitBrowsers(); 203 void QuitBrowsers();
188 204
189 // Prepare command line that will be used to launch the child browser process 205 // Prepare command line that will be used to launch the child browser process
190 // with an in-process test. 206 // with an in-process test.
191 void PrepareTestCommandLine(base::CommandLine* command_line); 207 void PrepareTestCommandLine(base::CommandLine* command_line);
192 208
209 // Will run accessibility checks and fail the test if there are any issues.
210 void RunAccessibilityChecks();
211
193 // Browser created from CreateBrowser. 212 // Browser created from CreateBrowser.
194 Browser* browser_; 213 Browser* browser_;
195 214
196 // 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
197 // specified in the command line. 216 // specified in the command line.
198 base::ScopedTempDir temp_user_data_dir_; 217 base::ScopedTempDir temp_user_data_dir_;
199 218
200 // True if we should exit the tests after the last browser instance closes. 219 // True if we should exit the tests after the last browser instance closes.
201 bool exit_when_last_browser_closes_; 220 bool exit_when_last_browser_closes_;
202 221
203 // True if the about:blank tab should be opened when the browser is launched. 222 // True if the about:blank tab should be opened when the browser is launched.
204 bool open_about_blank_on_browser_launch_; 223 bool open_about_blank_on_browser_launch_;
205 224
206 // True if this is a multi-desktop test (in which case this browser test will 225 // 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). 226 // not ensure that Browsers are only created on the tested desktop).
208 bool multi_desktop_test_; 227 bool multi_desktop_test_;
209 228
229 // True if the accessibility tests should be run.
230 bool run_accessibility_checks_;
231
232 // True if the accessibility test should run for a particular test case.
233 // This is reset for every test case.
234 bool run_accessibility_checks_for_test_case_;
235
210 #if defined(OS_MACOSX) 236 #if defined(OS_MACOSX)
211 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; 237 base::mac::ScopedNSAutoreleasePool* autorelease_pool_;
212 #endif // OS_MACOSX 238 #endif // OS_MACOSX
213 239
214 #if defined(OS_WIN) 240 #if defined(OS_WIN)
215 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; 241 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
216 #endif 242 #endif
217 }; 243 };
218 244
219 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ 245 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698