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

Side by Side Diff: chrome/test/ui/ui_test.h

Issue 5967003: Refactor UITestBase/ProxyLauncher. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add POD struct to hold some launcher variables. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_UI_UI_TEST_H_ 5 #ifndef CHROME_TEST_UI_UI_TEST_H_
6 #define CHROME_TEST_UI_UI_TEST_H_ 6 #define CHROME_TEST_UI_UI_TEST_H_
7 #pragma once 7 #pragma once
8 8
9 // This file provides a common base for running UI unit tests, which operate 9 // This file provides a common base for running UI unit tests, which operate
10 // the entire browser application in a separate process for holistic 10 // the entire browser application in a separate process for holistic
(...skipping 13 matching lines...) Expand all
24 #include "base/message_loop.h" 24 #include "base/message_loop.h"
25 #include "base/process.h" 25 #include "base/process.h"
26 #include "base/scoped_ptr.h" 26 #include "base/scoped_ptr.h"
27 #include "base/test/test_timeouts.h" 27 #include "base/test/test_timeouts.h"
28 #include "base/time.h" 28 #include "base/time.h"
29 #include "build/build_config.h" 29 #include "build/build_config.h"
30 // TODO(evanm): we should be able to just forward-declare 30 // TODO(evanm): we should be able to just forward-declare
31 // AutomationProxy here, but many files that #include this one don't 31 // AutomationProxy here, but many files that #include this one don't
32 // themselves #include automation_proxy.h. 32 // themselves #include automation_proxy.h.
33 #include "chrome/test/automation/automation_proxy.h" 33 #include "chrome/test/automation/automation_proxy.h"
34 #include "chrome/test/automation/proxy_launcher.h"
34 #include "testing/platform_test.h" 35 #include "testing/platform_test.h"
35 36
36 class AutomationProxy; 37 class AutomationProxy;
37 class BrowserProxy; 38 class BrowserProxy;
38 class DictionaryValue; 39 class DictionaryValue;
39 class FilePath; 40 class FilePath;
40 class GURL; 41 class GURL;
41 class ProxyLauncher;
42 class ScopedTempDir; 42 class ScopedTempDir;
43 class TabProxy; 43 class TabProxy;
44 44
45 // Base class for UI Tests. This implements the core of the functions. 45 // Base class for UI Tests. This implements the core of the functions.
46 // This base class decouples all automation functionality from testing 46 // This base class decouples all automation functionality from testing
47 // infrastructure, for use without gtest. 47 // infrastructure, for use without gtest.
48 // If using gtest, you probably want to inherit from UITest (declared below) 48 // If using gtest, you probably want to inherit from UITest (declared below)
49 // rather than UITestBase. 49 // rather than UITestBase.
50 class UITestBase { 50 class UITestBase {
51 protected: 51 protected:
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 int GetActiveTabIndex() { return GetActiveTabIndex(0); } 155 int GetActiveTabIndex() { return GetActiveTabIndex(0); }
156 156
157 // Like above, but looks at the window at the given index. 157 // Like above, but looks at the window at the given index.
158 int GetActiveTabIndex(int window_index); 158 int GetActiveTabIndex(int window_index);
159 159
160 // Returns true when the browser process is running, independent if any 160 // Returns true when the browser process is running, independent if any
161 // renderer process exists or not. It will returns false if an user closed the 161 // renderer process exists or not. It will returns false if an user closed the
162 // window or if the browser process died by itself. 162 // window or if the browser process died by itself.
163 bool IsBrowserRunning(); 163 bool IsBrowserRunning();
164 164
165 // Returns true when time_out_ms milliseconds have elapsed. 165 // Returns true when timeout_ms milliseconds have elapsed.
166 // Returns false if the browser process died while waiting. 166 // Returns false if the browser process died while waiting.
167 bool CrashAwareSleep(int time_out_ms); 167 bool CrashAwareSleep(int timeout_ms);
168 168
169 // Returns the number of tabs in the first window. If no windows exist, 169 // Returns the number of tabs in the first window. If no windows exist,
170 // causes a test failure and returns 0. 170 // causes a test failure and returns 0.
171 int GetTabCount(); 171 int GetTabCount();
172 172
173 // Same as GetTabCount(), except with the window at the given index. 173 // Same as GetTabCount(), except with the window at the given index.
174 int GetTabCount(int window_index); 174 int GetTabCount(int window_index);
175 175
176 // Polls up to kWaitForActionMaxMsec ms to attain a specific tab count. Will 176 // Polls up to kWaitForActionMaxMsec ms to attain a specific tab count. Will
177 // assert that the tab count is valid at the end of the wait. 177 // assert that the tab count is valid at the end of the wait.
178 void WaitUntilTabCount(int tab_count); 178 void WaitUntilTabCount(int tab_count);
179 179
180 // Wait for the browser process to shut down on its own (i.e. as a result of 180 // Wait for the browser process to shut down on its own (i.e. as a result of
181 // some action that your test has taken). 181 // some action that your test has taken).
182 bool WaitForBrowserProcessToQuit(); 182 bool WaitForBrowserProcessToQuit(int timeout);
183 183
184 // Waits until the Bookmark bar has stopped animating and become fully visible 184 // Waits until the Bookmark bar has stopped animating and become fully visible
185 // (if |wait_for_open| is true) or fully hidden (if |wait_for_open| is false). 185 // (if |wait_for_open| is true) or fully hidden (if |wait_for_open| is false).
186 // This function can time out (in which case it returns false). 186 // This function can time out (in which case it returns false).
187 bool WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, 187 bool WaitForBookmarkBarVisibilityChange(BrowserProxy* browser,
188 bool wait_for_open); 188 bool wait_for_open);
189 189
190 // Sends the request to close the browser without blocking. 190 // Sends the request to close the browser without blocking.
191 // This is so we can interact with dialogs opened on browser close, 191 // This is so we can interact with dialogs opened on browser close,
192 // e.g. the beforeunload confirm dialog. 192 // e.g. the beforeunload confirm dialog.
193 void CloseBrowserAsync(BrowserProxy* browser) const; 193 void CloseBrowserAsync(BrowserProxy* browser) const;
194 194
195 // Closes the specified browser. Returns true if the browser was closed. 195 // Closes the specified browser. Returns true if the browser was closed.
196 // This call is blocking. |application_closed| is set to true if this was 196 // This call is blocking. |application_closed| is set to true if this was
197 // the last browser window (and therefore as a result of it closing the 197 // the last browser window (and therefore as a result of it closing the
198 // browser process terminated). Note that in that case this method returns 198 // browser process terminated). Note that in that case this method returns
199 // after the browser process has terminated. 199 // after the browser process has terminated.
200 bool CloseBrowser(BrowserProxy* browser, bool* application_closed) const; 200 bool CloseBrowser(BrowserProxy* browser, bool* application_closed) const;
201 201
202 // Gets the directory for the currently active profile in the browser. 202 // Gets the directory for the currently active profile in the browser.
203 FilePath GetDownloadDirectory(); 203 FilePath GetDownloadDirectory();
204 204
205 // Get the handle of browser process connected to the automation. This
206 // function only retruns a reference to the handle so the caller does not
207 // own the handle returned.
208 base::ProcessHandle process() { return process_; }
209
210 // Get/Set a flag to run the renderer in process when running the
211 // tests.
212 static bool in_process_renderer() { return in_process_renderer_; }
213 static void set_in_process_renderer(bool value) {
214 in_process_renderer_ = value;
215 }
216
217 // Get/Set a flag to run the renderer outside the sandbox when running the
218 // tests
219 static bool no_sandbox() { return no_sandbox_; }
220 static void set_no_sandbox(bool value) {
221 no_sandbox_ = value;
222 }
223
224 // Get/Set a flag to run with DCHECKs enabled in release.
225 static bool enable_dcheck() { return enable_dcheck_; }
226 static void set_enable_dcheck(bool value) {
227 enable_dcheck_ = value;
228 }
229
230 // Get/Set a flag to dump the process memory without crashing on DCHECKs.
231 static bool silent_dump_on_dcheck() { return silent_dump_on_dcheck_; }
232 static void set_silent_dump_on_dcheck(bool value) {
233 silent_dump_on_dcheck_ = value;
234 }
235
236 // Get/Set a flag to disable breakpad handling.
237 static bool disable_breakpad() { return disable_breakpad_; }
238 static void set_disable_breakpad(bool value) {
239 disable_breakpad_ = value;
240 }
241
242 // Get/Set a flag to run the plugin processes inside the sandbox when running
243 // the tests
244 static bool safe_plugins() { return safe_plugins_; }
245 static void set_safe_plugins(bool value) {
246 safe_plugins_ = value;
247 }
248
249 static bool show_error_dialogs() { return show_error_dialogs_; }
250 static void set_show_error_dialogs(bool value) {
251 show_error_dialogs_ = value;
252 }
253
254 static bool full_memory_dump() { return full_memory_dump_; }
255 static void set_full_memory_dump(bool value) {
256 full_memory_dump_ = value;
257 }
258
259 static bool dump_histograms_on_exit() { return dump_histograms_on_exit_; }
260 static void set_dump_histograms_on_exit(bool value) {
261 dump_histograms_on_exit_ = value;
262 }
263
264 static const std::string& js_flags() { return js_flags_; }
265 static void set_js_flags(const std::string& value) {
266 js_flags_ = value;
267 }
268
269 static const std::string& log_level() { return log_level_; }
270 static void set_log_level(const std::string& value) {
271 log_level_ = value;
272 }
273
274 // Profile theme type choices.
275 typedef enum {
276 DEFAULT_THEME = 0,
277 COMPLEX_THEME = 1,
278 NATIVE_THEME = 2,
279 CUSTOM_FRAME = 3,
280 CUSTOM_FRAME_NATIVE_THEME = 4,
281 } ProfileType;
282
283 // Returns the directory name where the "typical" user data is that we use 205 // Returns the directory name where the "typical" user data is that we use
284 // for testing. 206 // for testing.
285 static FilePath ComputeTypicalUserDataSource(ProfileType profile_type); 207 static FilePath ComputeTypicalUserDataSource(
208 ProxyLauncher::ProfileType profile_type);
286 209
287 // Rewrite the preferences file to point to the proper image directory. 210 // Return the user data directory being used by the browser instance in
288 static void RewritePreferencesFile(const FilePath& user_data_dir); 211 // UITest::SetUp().
212 FilePath user_data_dir() const {
213 return launcher_->user_data_dir();
214 }
289 215
290 // Called by some tests that wish to have a base profile to start from. This 216 // Called by some tests that wish to have a base profile to start from. This
291 // "user data directory" (containing one or more profiles) will be recursively 217 // "user data directory" (containing one or more profiles) will be recursively
292 // copied into the user data directory for the test and the files will be 218 // copied into the user data directory for the test and the files will be
293 // evicted from the OS cache. To start with a blank profile, supply an empty 219 // evicted from the OS cache. To start with a blank profile, supply an empty
294 // string (the default). 220 // string (the default).
295 const FilePath& template_user_data() const { return template_user_data_; } 221 const FilePath& template_user_data() const { return template_user_data_; }
296 void set_template_user_data(const FilePath& template_user_data) { 222 void set_template_user_data(const FilePath& template_user_data) {
297 template_user_data_ = template_user_data; 223 template_user_data_ = template_user_data;
298 } 224 }
299 225
300 // Return the user data directory being used by the browser instance in 226 // Get the handle of browser process connected to the automation. This
301 // UITest::SetUp(). 227 // function only returns a reference to the handle so the caller does not
302 FilePath user_data_dir() const; 228 // own the handle returned.
229 base::ProcessHandle process() const { return launcher_->process(); }
303 230
304 // Return the process id of the browser process (-1 on error). 231 // Return the process id of the browser process (-1 on error).
305 base::ProcessId browser_process_id() const { return process_id_; } 232 base::ProcessId browser_process_id() const { return launcher_->process_id(); }
233
234 // Return the time when the browser was run.
235 base::TimeTicks browser_launch_time() const {
236 return launcher_->browser_launch_time();
237 }
238
239 // Return how long the shutdown took.
240 base::TimeDelta browser_quit_time() const {
241 return launcher_->browser_quit_time();
242 }
306 243
307 // Compatibility timeout accessors. 244 // Compatibility timeout accessors.
308 // TODO(phajdan.jr): update callers and remove these. 245 // TODO(phajdan.jr): update callers and remove these.
309 static int command_execution_timeout_ms() { 246 static int command_execution_timeout_ms() {
310 return TestTimeouts::command_execution_timeout_ms(); 247 return TestTimeouts::command_execution_timeout_ms();
311 } 248 }
312 static int action_timeout_ms() { 249 static int action_timeout_ms() {
313 return TestTimeouts::action_timeout_ms(); 250 return TestTimeouts::action_timeout_ms();
314 } 251 }
315 static int action_max_timeout_ms() { 252 static int action_max_timeout_ms() {
316 return TestTimeouts::action_max_timeout_ms(); 253 return TestTimeouts::action_max_timeout_ms();
317 } 254 }
318 static int sleep_timeout_ms() { 255 static int sleep_timeout_ms() {
319 // TODO(phajdan.jr): Fix all callers and remove sleep_timeout_ms. 256 // TODO(phajdan.jr): Fix all callers and remove sleep_timeout_ms.
320 return TestTimeouts::action_timeout_ms(); 257 return TestTimeouts::action_timeout_ms();
321 } 258 }
322 static int test_timeout_ms() { 259 static int test_timeout_ms() {
323 return TestTimeouts::huge_test_timeout_ms(); 260 return TestTimeouts::huge_test_timeout_ms();
324 } 261 }
325 262
326 void set_ui_test_name(const std::string& name) {
327 ui_test_name_ = name;
328 }
329
330 // Fetch the state which determines whether the profile will be cleared on 263 // Fetch the state which determines whether the profile will be cleared on
331 // next startup. 264 // next startup.
332 bool get_clear_profile() const { 265 bool get_clear_profile() const {
333 return clear_profile_; 266 return clear_profile_;
334 } 267 }
335 // Sets clear_profile_. Should be called before launching browser to have 268 // Sets clear_profile_. Should be called before launching browser to have
336 // any effect. 269 // any effect.
337 void set_clear_profile(bool clear_profile) { 270 void set_clear_profile(bool clear_profile) {
338 clear_profile_ = clear_profile; 271 clear_profile_ = clear_profile;
339 } 272 }
340 273
274 // homepage_ accessor.
275 std::string homepage() {
276 return homepage_;
277 }
278
341 // Sets homepage_. Should be called before launching browser to have 279 // Sets homepage_. Should be called before launching browser to have
342 // any effect. 280 // any effect.
343 void set_homepage(const std::string& homepage) { 281 void set_homepage(const std::string& homepage) {
344 homepage_ = homepage; 282 homepage_ = homepage;
345 } 283 }
346 284
347 // Different ways to quit the browser. 285 void set_test_name(const std::string& name) {
348 typedef enum { 286 test_name_ = name;
349 WINDOW_CLOSE, 287 }
350 USER_QUIT,
351 SESSION_ENDING,
352 } ShutdownType;
353 288
354 // Sets the shutdown type, which defaults to WINDOW_CLOSE. 289 // Sets the shutdown type, which defaults to WINDOW_CLOSE.
355 void set_shutdown_type(ShutdownType value) { 290 void set_shutdown_type(ProxyLauncher::ShutdownType value) {
356 shutdown_type_ = value; 291 shutdown_type_ = value;
357 } 292 }
358 293
359 // Get the number of crash dumps we've logged since the test started. 294 // Get the number of crash dumps we've logged since the test started.
360 int GetCrashCount(); 295 int GetCrashCount();
361 296
362 // Use Chromium binaries from the given directory. 297 // Use Chromium binaries from the given directory.
363 void SetBrowserDirectory(const FilePath& dir); 298 void SetBrowserDirectory(const FilePath& dir);
364 299
365 private: 300 protected:
366 // Check that no processes related to Chrome exist, displaying 301 AutomationProxy* automation() const {
367 // the given message if any do. 302 return launcher_->automation();
368 void AssertAppNotRunning(const std::wstring& error_message); 303 }
369 304
370 protected: 305 ProxyLauncher::LaunchState DefaultLaunchState() {
371 AutomationProxy* automation() { 306 ProxyLauncher::LaunchState state =
372 EXPECT_TRUE(automation_proxy_.get()); 307 { clear_profile_, template_user_data_, profile_type_,
373 return automation_proxy_.get(); 308 browser_directory_, launch_arguments_,
309 include_testing_id_, show_window_ };
310 return state;
374 } 311 }
375 312
376 virtual bool ShouldFilterInet() { 313 virtual bool ShouldFilterInet() {
377 return true; 314 return true;
378 } 315 }
379 316
317 // Extra command-line switches that need to be passed to the browser are
318 // added in this function. Add new command-line switches here.
319 void SetLaunchSwitches();
320
380 // Wait a certain amount of time for all the app processes to exit, 321 // Wait a certain amount of time for all the app processes to exit,
381 // forcibly killing them if they haven't exited by then. 322 // forcibly killing them if they haven't exited by then.
382 // It has the side-effect of killing every browser window opened in your 323 // It has the side-effect of killing every browser window opened in your
383 // session, even those unrelated in the test. 324 // session, even those unrelated in the test.
384 void CleanupAppProcesses(); 325 void CleanupAppProcesses();
385 326
386 // Returns the proxy for the currently active tab, or NULL if there is no 327 // Returns the proxy for the currently active tab, or NULL if there is no
387 // tab or there was some kind of error. Only looks at the first window, for 328 // tab or there was some kind of error. Only looks at the first window, for
388 // backward compatibility. The returned pointer MUST be deleted by the 329 // backward compatibility. The returned pointer MUST be deleted by the
389 // caller if non-NULL. 330 // caller if non-NULL.
390 scoped_refptr<TabProxy> GetActiveTab(); 331 scoped_refptr<TabProxy> GetActiveTab();
391 332
392 // Like above, but looks at the window at the given index. 333 // Like above, but looks at the window at the given index.
393 scoped_refptr<TabProxy> GetActiveTab(int window_index); 334 scoped_refptr<TabProxy> GetActiveTab(int window_index);
394 335
395 // ********* Member variables ********* 336 // ********* Member variables *********
396 337
397 FilePath browser_directory_; // Path to the browser executable. 338 // Path to the browser executable.
398 FilePath test_data_directory_; // Path to the unit test data. 339 FilePath browser_directory_;
399 CommandLine launch_arguments_; // Command to launch the browser 340
400 size_t expected_errors_; // The number of errors expected during 341 // Path to the unit test data.
401 // the run (generally 0). 342 FilePath test_data_directory_;
402 int expected_crashes_; // The number of crashes expected during 343
403 // the run (generally 0). 344 // Command to launch the browser
404 std::string homepage_; // Homepage used for testing. 345 CommandLine launch_arguments_;
405 bool wait_for_initial_loads_; // Wait for initial loads to complete 346
406 // in SetUp() before running test body. 347 // The number of errors expected during the run (generally 0).
407 base::TimeTicks browser_launch_time_; // Time when the browser was run. 348 size_t expected_errors_;
408 base::TimeDelta browser_quit_time_; // How long the shutdown took. 349
409 bool dom_automation_enabled_; // This can be set to true to have the 350 // The number of crashes expected during the run (generally 0).
410 // test run the dom automation case. 351 int expected_crashes_;
411 FilePath template_user_data_; // See set_template_user_data(). 352
412 base::ProcessHandle process_; // Handle to the first Chrome process. 353 // Homepage used for testing.
413 base::ProcessId process_id_; // PID of |process_| (for debugging). 354 std::string homepage_;
414 static bool in_process_renderer_; // true if we're in single process mode 355
415 bool show_window_; // Determines if the window is shown or 356 // Name of currently running automated test passed to Chrome process.
416 // hidden. Defaults to hidden. 357 std::string test_name_;
417 bool clear_profile_; // If true the profile is cleared before 358
418 // launching. Default is true. 359 // Wait for initial loads to complete in SetUp() before running test body.
419 bool include_testing_id_; // Should we supply the testing channel 360 bool wait_for_initial_loads_;
420 // id on the command line? Default is 361
421 // true. 362 // This can be set to true to have the test run the dom automation case.
422 bool enable_file_cookies_; // Enable file cookies, default is true. 363 bool dom_automation_enabled_;
423 scoped_ptr<ProxyLauncher> launcher_; // Launches browser and AutomationProxy. 364
424 ProfileType profile_type_; // Are we using a profile with a 365 // See set_template_user_data().
425 // complex theme? 366 FilePath template_user_data_;
426 FilePath websocket_pid_file_; // PID file for websocket server. 367
427 ShutdownType shutdown_type_; // The method for shutting down 368 // Determines if the window is shown or hidden. Defaults to hidden.
428 // the browser. Used in ShutdownTest. 369 bool show_window_;
370
371 // If true the profile is cleared before launching. Default is true.
372 bool clear_profile_;
373
374 // Should we supply the testing channel id
375 // on the command line? Default is true.
376 bool include_testing_id_;
377
378 // Enable file cookies, default is true.
379 bool enable_file_cookies_;
380
381 // Launches browser and AutomationProxy.
382 scoped_ptr<ProxyLauncher> launcher_;
383
384 // Are we using a profile with a complex theme?
385 ProxyLauncher::ProfileType profile_type_;
386
387 // PID file for websocket server.
388 FilePath websocket_pid_file_;
389
390 // The method for shutting down the browser. Used in ShutdownTest.
391 ProxyLauncher::ShutdownType shutdown_type_;
429 392
430 private: 393 private:
431 void WaitForBrowserLaunch(); 394 // Time the test was started (so we can check for new crash dumps)
432 395 base::Time test_start_time_;
433 bool LaunchBrowserHelper(const CommandLine& arguments,
434 bool wait,
435 base::ProcessHandle* process);
436
437 // Prepare command line that will be used to launch the child browser process
438 // with an UI test.
439 void PrepareTestCommandline(CommandLine* arguments);
440
441 // We want to have a current history database when we start the browser so
442 // things like the NTP will have thumbnails. This method updates the dates
443 // in the history to be more recent.
444 void UpdateHistoryDates();
445
446 base::Time test_start_time_; // Time the test was started
447 // (so we can check for new crash dumps)
448 static bool no_sandbox_;
449 static bool safe_plugins_;
450 static bool full_memory_dump_; // If true, write full memory dump
451 // during crash.
452 static bool show_error_dialogs_; // If true, a user is paying attention
453 // to the test, so show error dialogs.
454 static bool dump_histograms_on_exit_; // Include histograms in log on exit.
455 static bool enable_dcheck_; // Enable dchecks in release mode.
456 static bool silent_dump_on_dcheck_; // Dump process memory on dcheck without
457 // crashing.
458 static bool disable_breakpad_; // Disable breakpad on the browser.
459 static int timeout_ms_; // Timeout in milliseconds to wait
460 // for an test to finish.
461 static std::string js_flags_; // Flags passed to the JS engine.
462 static std::string log_level_; // Logging level.
463
464 scoped_ptr<AutomationProxy> automation_proxy_;
465
466 std::string ui_test_name_;
467
468 // We use a temporary directory for profile to avoid issues with being
469 // unable to delete some files because they're in use, etc.
470 scoped_ptr<ScopedTempDir> temp_profile_dir_;
471 }; 396 };
472 397
473 class UITest : public UITestBase, public PlatformTest { 398 class UITest : public UITestBase, public PlatformTest {
474 protected: 399 protected:
475 UITest() {} 400 UITest() {}
476 explicit UITest(MessageLoop::Type msg_loop_type) 401 explicit UITest(MessageLoop::Type msg_loop_type)
477 : UITestBase(), PlatformTest(), message_loop_(msg_loop_type) { 402 : UITestBase(), PlatformTest(), message_loop_(msg_loop_type) {
478 } 403 }
479 virtual void SetUp(); 404 virtual void SetUp();
480 virtual void TearDown(); 405 virtual void TearDown();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 void WaitForGeneratedFileAndCheck(const FilePath& generated_file, 450 void WaitForGeneratedFileAndCheck(const FilePath& generated_file,
526 const FilePath& original_file, 451 const FilePath& original_file,
527 bool compare_files, 452 bool compare_files,
528 bool need_equal, 453 bool need_equal,
529 bool delete_generated_file); 454 bool delete_generated_file);
530 455
531 // Polls the tab for a JavaScript condition and returns once one of the 456 // Polls the tab for a JavaScript condition and returns once one of the
532 // following conditions hold true: 457 // following conditions hold true:
533 // - The JavaScript condition evaluates to true (return true). 458 // - The JavaScript condition evaluates to true (return true).
534 // - The browser process died (return false). 459 // - The browser process died (return false).
535 // - The time_out value has been exceeded (return false). 460 // - The timeout value has been exceeded (return false).
536 // 461 //
537 // The JavaScript expression is executed in the context of the frame that 462 // The JavaScript expression is executed in the context of the frame that
538 // matches the provided xpath. 463 // matches the provided xpath.
539 bool WaitUntilJavaScriptCondition(TabProxy* tab, 464 bool WaitUntilJavaScriptCondition(TabProxy* tab,
540 const std::wstring& frame_xpath, 465 const std::wstring& frame_xpath,
541 const std::wstring& jscript, 466 const std::wstring& jscript,
542 int time_out_ms); 467 int timeout_ms);
543 468
544 // Polls the tab for the cookie_name cookie and returns once one of the 469 // Polls the tab for the cookie_name cookie and returns once one of the
545 // following conditions hold true: 470 // following conditions hold true:
546 // - The cookie is of expected_value. 471 // - The cookie is of expected_value.
547 // - The browser process died. 472 // - The browser process died.
548 // - The time_out value has been exceeded. 473 // - The timeout value has been exceeded.
549 bool WaitUntilCookieValue(TabProxy* tab, const GURL& url, 474 bool WaitUntilCookieValue(TabProxy* tab, const GURL& url,
550 const char* cookie_name, 475 const char* cookie_name,
551 int time_out_ms, 476 int timeout_ms,
552 const char* expected_value); 477 const char* expected_value);
553 478
554 // Polls the tab for the cookie_name cookie and returns once one of the 479 // Polls the tab for the cookie_name cookie and returns once one of the
555 // following conditions hold true: 480 // following conditions hold true:
556 // - The cookie is set to any value. 481 // - The cookie is set to any value.
557 // - The browser process died. 482 // - The browser process died.
558 // - The time_out value has been exceeded. 483 // - The timeout value has been exceeded.
559 std::string WaitUntilCookieNonEmpty(TabProxy* tab, 484 std::string WaitUntilCookieNonEmpty(TabProxy* tab,
560 const GURL& url, 485 const GURL& url,
561 const char* cookie_name, 486 const char* cookie_name,
562 int time_out_ms); 487 int timeout_ms);
563 488
564 // Checks whether the download shelf is visible in the current browser, giving 489 // Checks whether the download shelf is visible in the current browser, giving
565 // it a chance to appear (we don't know the exact timing) while finishing as 490 // it a chance to appear (we don't know the exact timing) while finishing as
566 // soon as possible. 491 // soon as possible.
567 bool WaitForDownloadShelfVisible(BrowserProxy* browser); 492 bool WaitForDownloadShelfVisible(BrowserProxy* browser);
568 493
569 // Checks whether the download shelf is invisible in the current browser, 494 // Checks whether the download shelf is invisible in the current browser,
570 // giving it a chance to appear (we don't know the exact timing) while 495 // giving it a chance to appear (we don't know the exact timing) while
571 // finishing as soon as possible. 496 // finishing as soon as possible.
572 bool WaitForDownloadShelfInvisible(BrowserProxy* browser); 497 bool WaitForDownloadShelfInvisible(BrowserProxy* browser);
(...skipping 17 matching lines...) Expand all
590 #ifdef UNIT_TEST 515 #ifdef UNIT_TEST
591 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); 516 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr);
592 517
593 template<typename T> 518 template<typename T>
594 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { 519 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) {
595 return out << ptr.get(); 520 return out << ptr.get();
596 } 521 }
597 #endif // UNIT_TEST 522 #endif // UNIT_TEST
598 523
599 #endif // CHROME_TEST_UI_UI_TEST_H_ 524 #endif // CHROME_TEST_UI_UI_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698