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

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: Changes per Paweł's comments. 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.
(...skipping 22 matching lines...) Expand all
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 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 206 // function only retruns a reference to the handle so the caller does not
207 // own the handle returned. 207 // own the handle returned.
208 base::ProcessHandle process() { return process_; } 208 base::ProcessHandle process() { return process_; }
209 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 210 // Returns the directory name where the "typical" user data is that we use
284 // for testing. 211 // for testing.
285 static FilePath ComputeTypicalUserDataSource(ProfileType profile_type); 212 static FilePath ComputeTypicalUserDataSource(
213 ProxyLauncher::ProfileType profile_type);
286 214
287 // Rewrite the preferences file to point to the proper image directory. 215 // Return the user data directory being used by the browser instance in
288 static void RewritePreferencesFile(const FilePath& user_data_dir); 216 // UITest::SetUp().
217 FilePath user_data_dir() const {
218 return launcher_->user_data_dir();
219 }
289 220
290 // Called by some tests that wish to have a base profile to start from. This 221 // 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 222 // "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 223 // 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 224 // evicted from the OS cache. To start with a blank profile, supply an empty
294 // string (the default). 225 // string (the default).
295 const FilePath& template_user_data() const { return template_user_data_; } 226 const FilePath& template_user_data() const { return template_user_data_; }
296 void set_template_user_data(const FilePath& template_user_data) { 227 void set_template_user_data(const FilePath& template_user_data) {
297 template_user_data_ = template_user_data; 228 template_user_data_ = template_user_data;
298 } 229 }
299 230
300 // Return the user data directory being used by the browser instance in
301 // UITest::SetUp().
302 FilePath user_data_dir() const;
303
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 process_id_; }
306 233
307 // Compatibility timeout accessors. 234 // Compatibility timeout accessors.
308 // TODO(phajdan.jr): update callers and remove these. 235 // TODO(phajdan.jr): update callers and remove these.
309 static int command_execution_timeout_ms() { 236 static int command_execution_timeout_ms() {
310 return TestTimeouts::command_execution_timeout_ms(); 237 return TestTimeouts::command_execution_timeout_ms();
311 } 238 }
312 static int action_timeout_ms() { 239 static int action_timeout_ms() {
313 return TestTimeouts::action_timeout_ms(); 240 return TestTimeouts::action_timeout_ms();
314 } 241 }
315 static int action_max_timeout_ms() { 242 static int action_max_timeout_ms() {
316 return TestTimeouts::action_max_timeout_ms(); 243 return TestTimeouts::action_max_timeout_ms();
317 } 244 }
318 static int sleep_timeout_ms() { 245 static int sleep_timeout_ms() {
319 // TODO(phajdan.jr): Fix all callers and remove sleep_timeout_ms. 246 // TODO(phajdan.jr): Fix all callers and remove sleep_timeout_ms.
320 return TestTimeouts::action_timeout_ms(); 247 return TestTimeouts::action_timeout_ms();
321 } 248 }
322 static int test_timeout_ms() { 249 static int test_timeout_ms() {
323 return TestTimeouts::huge_test_timeout_ms(); 250 return TestTimeouts::huge_test_timeout_ms();
324 } 251 }
325 252
326 void set_ui_test_name(const std::string& name) { 253 void set_test_name(const std::string& name) {
327 ui_test_name_ = name; 254 launcher_->set_test_name(name);
328 } 255 }
329 256
330 // Fetch the state which determines whether the profile will be cleared on 257 // Fetch the state which determines whether the profile will be cleared on
331 // next startup. 258 // next startup.
332 bool get_clear_profile() const { 259 bool get_clear_profile() const {
333 return clear_profile_; 260 return clear_profile_;
334 } 261 }
335 // Sets clear_profile_. Should be called before launching browser to have 262 // Sets clear_profile_. Should be called before launching browser to have
336 // any effect. 263 // any effect.
337 void set_clear_profile(bool clear_profile) { 264 void set_clear_profile(bool clear_profile) {
338 clear_profile_ = clear_profile; 265 clear_profile_ = clear_profile;
339 } 266 }
340 267
341 // Sets homepage_. Should be called before launching browser to have 268 // Sets homepage_. Should be called before launching browser to have
342 // any effect. 269 // any effect.
343 void set_homepage(const std::string& homepage) { 270 void set_homepage(const std::string& homepage) {
344 homepage_ = homepage; 271 launcher_->set_homepage(homepage);
345 } 272 }
346 273
347 // Different ways to quit the browser.
348 typedef enum {
349 WINDOW_CLOSE,
350 USER_QUIT,
351 SESSION_ENDING,
352 } ShutdownType;
353
354 // Sets the shutdown type, which defaults to WINDOW_CLOSE. 274 // Sets the shutdown type, which defaults to WINDOW_CLOSE.
355 void set_shutdown_type(ShutdownType value) { 275 void set_shutdown_type(ProxyLauncher::ShutdownType value) {
356 shutdown_type_ = value; 276 shutdown_type_ = value;
357 } 277 }
358 278
359 // Get the number of crash dumps we've logged since the test started. 279 // Get the number of crash dumps we've logged since the test started.
360 int GetCrashCount(); 280 int GetCrashCount();
361 281
362 // Use Chromium binaries from the given directory. 282 // Use Chromium binaries from the given directory.
363 void SetBrowserDirectory(const FilePath& dir); 283 void SetBrowserDirectory(const FilePath& dir);
364 284
365 private:
366 // Check that no processes related to Chrome exist, displaying
367 // the given message if any do.
368 void AssertAppNotRunning(const std::wstring& error_message);
369
370 protected: 285 protected:
371 AutomationProxy* automation() { 286 AutomationProxy* automation() const {
372 EXPECT_TRUE(automation_proxy_.get()); 287 return launcher_->automation();
373 return automation_proxy_.get();
374 } 288 }
375 289
376 virtual bool ShouldFilterInet() { 290 virtual bool ShouldFilterInet() {
377 return true; 291 return true;
378 } 292 }
379 293
294 // Extra command-line switches that need to be passed to the browser are
295 // added in this function. Add new command-line switches here.
296 void SetLaunchSwitches();
297
380 // Wait a certain amount of time for all the app processes to exit, 298 // Wait a certain amount of time for all the app processes to exit,
381 // forcibly killing them if they haven't exited by then. 299 // forcibly killing them if they haven't exited by then.
382 // It has the side-effect of killing every browser window opened in your 300 // It has the side-effect of killing every browser window opened in your
383 // session, even those unrelated in the test. 301 // session, even those unrelated in the test.
384 void CleanupAppProcesses(); 302 void CleanupAppProcesses();
385 303
386 // Returns the proxy for the currently active tab, or NULL if there is no 304 // 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 305 // 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 306 // backward compatibility. The returned pointer MUST be deleted by the
389 // caller if non-NULL. 307 // caller if non-NULL.
390 scoped_refptr<TabProxy> GetActiveTab(); 308 scoped_refptr<TabProxy> GetActiveTab();
391 309
392 // Like above, but looks at the window at the given index. 310 // Like above, but looks at the window at the given index.
393 scoped_refptr<TabProxy> GetActiveTab(int window_index); 311 scoped_refptr<TabProxy> GetActiveTab(int window_index);
394 312
395 // ********* Member variables ********* 313 // ********* Member variables *********
396 314
397 FilePath browser_directory_; // Path to the browser executable. 315 // Path to the browser executable.
Paweł Hajdan Jr. 2011/01/06 20:37:14 nit: Separate the variables by blank lines.
dtu 2011/01/07 01:46:17 Done.
398 FilePath test_data_directory_; // Path to the unit test data. 316 FilePath browser_directory_;
399 CommandLine launch_arguments_; // Command to launch the browser 317 // Path to the unit test data.
400 size_t expected_errors_; // The number of errors expected during 318 FilePath test_data_directory_;
401 // the run (generally 0). 319 // Command to launch the browser
402 int expected_crashes_; // The number of crashes expected during 320 CommandLine launch_arguments_;
403 // the run (generally 0). 321 // The number of errors expected during the run (generally 0).
404 std::string homepage_; // Homepage used for testing. 322 size_t expected_errors_;
405 bool wait_for_initial_loads_; // Wait for initial loads to complete 323 // The number of crashes expected during the run (generally 0).
406 // in SetUp() before running test body. 324 int expected_crashes_;
407 base::TimeTicks browser_launch_time_; // Time when the browser was run. 325 // Wait for initial loads to complete in SetUp() before running test body.
408 base::TimeDelta browser_quit_time_; // How long the shutdown took. 326 bool wait_for_initial_loads_;
409 bool dom_automation_enabled_; // This can be set to true to have the 327 // Time when the browser was run.
410 // test run the dom automation case. 328 base::TimeTicks browser_launch_time_;
411 FilePath template_user_data_; // See set_template_user_data(). 329 // How long the shutdown took.
412 base::ProcessHandle process_; // Handle to the first Chrome process. 330 base::TimeDelta browser_quit_time_;
413 base::ProcessId process_id_; // PID of |process_| (for debugging). 331 // This can be set to true to have the test run the dom automation case.
414 static bool in_process_renderer_; // true if we're in single process mode 332 bool dom_automation_enabled_;
415 bool show_window_; // Determines if the window is shown or 333 // See set_template_user_data().
416 // hidden. Defaults to hidden. 334 FilePath template_user_data_;
417 bool clear_profile_; // If true the profile is cleared before 335 // Handle to the first Chrome process.
418 // launching. Default is true. 336 base::ProcessHandle process_;
419 bool include_testing_id_; // Should we supply the testing channel 337 // PID of |process_| (for debugging).
420 // id on the command line? Default is 338 base::ProcessId process_id_;
421 // true. 339 // Determines if the window is shown or hidden. Defaults to hidden.
422 bool enable_file_cookies_; // Enable file cookies, default is true. 340 bool show_window_;
423 scoped_ptr<ProxyLauncher> launcher_; // Launches browser and AutomationProxy. 341 // If true the profile is cleared before launching. Default is true.
424 ProfileType profile_type_; // Are we using a profile with a 342 bool clear_profile_;
425 // complex theme? 343 // Should we supply the testing channel id on the command line? Default is tru e.
Paweł Hajdan Jr. 2011/01/06 20:37:14 nit: 80 cols.
dtu 2011/01/07 01:46:17 Done.
426 FilePath websocket_pid_file_; // PID file for websocket server. 344 bool include_testing_id_;
427 ShutdownType shutdown_type_; // The method for shutting down 345 // Enable file cookies, default is true.
428 // the browser. Used in ShutdownTest. 346 bool enable_file_cookies_;
347 // Launches browser and AutomationProxy.
348 scoped_ptr<ProxyLauncher> launcher_;
349 // Are we using a profile with a complex theme?
350 ProxyLauncher::ProfileType profile_type_;
351 // PID file for websocket server.
352 FilePath websocket_pid_file_;
353 // The method for shutting down the browser. Used in ShutdownTest.
354 ProxyLauncher::ShutdownType shutdown_type_;
429 355
430 private: 356 private:
431 void WaitForBrowserLaunch(); 357 // Time the test was started (so we can check for new crash dumps)
432 358 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 }; 359 };
472 360
473 class UITest : public UITestBase, public PlatformTest { 361 class UITest : public UITestBase, public PlatformTest {
474 protected: 362 protected:
475 UITest() {} 363 UITest() {}
476 explicit UITest(MessageLoop::Type msg_loop_type) 364 explicit UITest(MessageLoop::Type msg_loop_type)
477 : UITestBase(), PlatformTest(), message_loop_(msg_loop_type) { 365 : UITestBase(), PlatformTest(), message_loop_(msg_loop_type) {
478 } 366 }
479 virtual void SetUp(); 367 virtual void SetUp();
480 virtual void TearDown(); 368 virtual void TearDown();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 void WaitForGeneratedFileAndCheck(const FilePath& generated_file, 413 void WaitForGeneratedFileAndCheck(const FilePath& generated_file,
526 const FilePath& original_file, 414 const FilePath& original_file,
527 bool compare_files, 415 bool compare_files,
528 bool need_equal, 416 bool need_equal,
529 bool delete_generated_file); 417 bool delete_generated_file);
530 418
531 // Polls the tab for a JavaScript condition and returns once one of the 419 // Polls the tab for a JavaScript condition and returns once one of the
532 // following conditions hold true: 420 // following conditions hold true:
533 // - The JavaScript condition evaluates to true (return true). 421 // - The JavaScript condition evaluates to true (return true).
534 // - The browser process died (return false). 422 // - The browser process died (return false).
535 // - The time_out value has been exceeded (return false). 423 // - The timeout value has been exceeded (return false).
536 // 424 //
537 // The JavaScript expression is executed in the context of the frame that 425 // The JavaScript expression is executed in the context of the frame that
538 // matches the provided xpath. 426 // matches the provided xpath.
539 bool WaitUntilJavaScriptCondition(TabProxy* tab, 427 bool WaitUntilJavaScriptCondition(TabProxy* tab,
540 const std::wstring& frame_xpath, 428 const std::wstring& frame_xpath,
541 const std::wstring& jscript, 429 const std::wstring& jscript,
542 int time_out_ms); 430 int timeout_ms);
543 431
544 // Polls the tab for the cookie_name cookie and returns once one of the 432 // Polls the tab for the cookie_name cookie and returns once one of the
545 // following conditions hold true: 433 // following conditions hold true:
546 // - The cookie is of expected_value. 434 // - The cookie is of expected_value.
547 // - The browser process died. 435 // - The browser process died.
548 // - The time_out value has been exceeded. 436 // - The timeout value has been exceeded.
549 bool WaitUntilCookieValue(TabProxy* tab, const GURL& url, 437 bool WaitUntilCookieValue(TabProxy* tab, const GURL& url,
550 const char* cookie_name, 438 const char* cookie_name,
551 int time_out_ms, 439 int timeout_ms,
552 const char* expected_value); 440 const char* expected_value);
553 441
554 // Polls the tab for the cookie_name cookie and returns once one of the 442 // Polls the tab for the cookie_name cookie and returns once one of the
555 // following conditions hold true: 443 // following conditions hold true:
556 // - The cookie is set to any value. 444 // - The cookie is set to any value.
557 // - The browser process died. 445 // - The browser process died.
558 // - The time_out value has been exceeded. 446 // - The timeout value has been exceeded.
559 std::string WaitUntilCookieNonEmpty(TabProxy* tab, 447 std::string WaitUntilCookieNonEmpty(TabProxy* tab,
560 const GURL& url, 448 const GURL& url,
561 const char* cookie_name, 449 const char* cookie_name,
562 int time_out_ms); 450 int timeout_ms);
563 451
564 // Checks whether the download shelf is visible in the current browser, giving 452 // 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 453 // it a chance to appear (we don't know the exact timing) while finishing as
566 // soon as possible. 454 // soon as possible.
567 bool WaitForDownloadShelfVisible(BrowserProxy* browser); 455 bool WaitForDownloadShelfVisible(BrowserProxy* browser);
568 456
569 // Checks whether the download shelf is invisible in the current browser, 457 // 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 458 // giving it a chance to appear (we don't know the exact timing) while
571 // finishing as soon as possible. 459 // finishing as soon as possible.
572 bool WaitForDownloadShelfInvisible(BrowserProxy* browser); 460 bool WaitForDownloadShelfInvisible(BrowserProxy* browser);
(...skipping 17 matching lines...) Expand all
590 #ifdef UNIT_TEST 478 #ifdef UNIT_TEST
591 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr); 479 std::ostream& operator<<(std::ostream& out, const std::wstring& wstr);
592 480
593 template<typename T> 481 template<typename T>
594 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) { 482 std::ostream& operator<<(std::ostream& out, const ::scoped_ptr<T>& ptr) {
595 return out << ptr.get(); 483 return out << ptr.get();
596 } 484 }
597 #endif // UNIT_TEST 485 #endif // UNIT_TEST
598 486
599 #endif // CHROME_TEST_UI_UI_TEST_H_ 487 #endif // CHROME_TEST_UI_UI_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698