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

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

Issue 7553009: Add some browser tests for net-internals (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix test_view.js Created 9 years, 4 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/common/url_constants.cc ('k') | chrome/test/base/ui_test_utils.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_UI_TEST_UTILS_H_ 5 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_
6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ 6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 std::map<uintptr_t, U> details_; 481 std::map<uintptr_t, U> details_;
482 482
483 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserverWithDetails); 483 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserverWithDetails);
484 }; 484 };
485 485
486 // Watches title changes on a tab, blocking until an expected title is set. 486 // Watches title changes on a tab, blocking until an expected title is set.
487 class TitleWatcher : public NotificationObserver { 487 class TitleWatcher : public NotificationObserver {
488 public: 488 public:
489 // |tab_contents| must be non-NULL and needs to stay alive for the 489 // |tab_contents| must be non-NULL and needs to stay alive for the
490 // entire lifetime of |this|. |expected_title| is the title that |this| 490 // entire lifetime of |this|. |expected_title| is the title that |this|
491 // will wait for. 491 // will wait for. If it's not an empty string, |this| will wait for
492 TitleWatcher(TabContents* tab_contents, const string16& expected_title); 492 // |failure_title| is well.
493 TitleWatcher(TabContents* tab_contents, const string16& expected_title,
494 const string16& failure_title);
493 virtual ~TitleWatcher(); 495 virtual ~TitleWatcher();
494 496
495 // Waits until the title for the tab is set to the |expected_title| 497 // Waits until the title for the tab is set to the |expected_title| or
496 // passed into the constructor. 498 // |failure_title| passed into the constructor or one of the titles added with
499 // AddTitle. Returns true if |expected_title| was seen, and false if
500 // |failure_title| was seen. If both are seen, returns false, however, it's
501 // probably best not to rely of that to avoid any races.
Paweł Hajdan Jr. 2011/08/02 20:19:16 How about returning the last seen title when the m
mmenke 2011/08/02 21:04:40 Sounds good to me. Done. Went ahead and switched
497 bool Wait() WARN_UNUSED_RESULT; 502 bool Wait() WARN_UNUSED_RESULT;
498 503
499 private: 504 private:
500 // NotificationObserver 505 // NotificationObserver
501 virtual void Observe(int type, 506 virtual void Observe(int type,
502 const NotificationSource& source, 507 const NotificationSource& source,
503 const NotificationDetails& details) OVERRIDE; 508 const NotificationDetails& details) OVERRIDE;
504 509
505 TabContents* expected_tab_; 510 TabContents* expected_tab_;
506 string16 expected_title_; 511 string16 expected_title_;
512 string16 failure_title_;
507 NotificationRegistrar notification_registrar_; 513 NotificationRegistrar notification_registrar_;
508 bool title_observed_; 514 bool expected_title_observed_;
515 bool failure_title_observed_;
509 bool quit_loop_on_observation_; 516 bool quit_loop_on_observation_;
510 517
511 DISALLOW_COPY_AND_ASSIGN(TitleWatcher); 518 DISALLOW_COPY_AND_ASSIGN(TitleWatcher);
512 }; 519 };
513 520
514 // See SendKeyPressAndWait. This function additionally performs a check on the 521 // See SendKeyPressAndWait. This function additionally performs a check on the
515 // NotificationDetails using the provided Details<U>. 522 // NotificationDetails using the provided Details<U>.
516 template <class U> 523 template <class U>
517 bool SendKeyPressAndWaitWithDetails( 524 bool SendKeyPressAndWaitWithDetails(
518 const Browser* browser, 525 const Browser* browser,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 598
592 // Takes a snapshot of the entire page, according to the width and height 599 // Takes a snapshot of the entire page, according to the width and height
593 // properties of the DOM's document. Returns true on success. DOMAutomation 600 // properties of the DOM's document. Returns true on success. DOMAutomation
594 // must be enabled. 601 // must be enabled.
595 bool TakeEntirePageSnapshot(RenderViewHost* rvh, 602 bool TakeEntirePageSnapshot(RenderViewHost* rvh,
596 SkBitmap* bitmap) WARN_UNUSED_RESULT; 603 SkBitmap* bitmap) WARN_UNUSED_RESULT;
597 604
598 } // namespace ui_test_utils 605 } // namespace ui_test_utils
599 606
600 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ 607 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/common/url_constants.cc ('k') | chrome/test/base/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698