diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 22:29:09 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-23 22:29:09 +0000 |
commit | 02e916564377084a66da758a7ff42ad4eaf10626 (patch) | |
tree | 0098a7d2a8f63d6991bcdca0b99ddcdc5ca1e159 /chrome/test/ui_test_utils.cc | |
parent | d5c23bed766a0182441bfe487345c1fa448cfe82 (diff) | |
download | chromium_src-02e916564377084a66da758a7ff42ad4eaf10626.zip chromium_src-02e916564377084a66da758a7ff42ad4eaf10626.tar.gz chromium_src-02e916564377084a66da758a7ff42ad4eaf10626.tar.bz2 |
Changes ui_test_utils::WindowedNotificationObserver to allow Wait to
work for any source.
BUG=none
TEST=none
R=phajdan.jr@chromium.org
Review URL: http://codereview.chromium.org/6722027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui_test_utils.cc')
-rw-r--r-- | chrome/test/ui_test_utils.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc index cdd7d0a..4d0a49a 100644 --- a/chrome/test/ui_test_utils.cc +++ b/chrome/test/ui_test_utils.cc @@ -927,13 +927,10 @@ WindowedNotificationObserver::WindowedNotificationObserver( WindowedNotificationObserver::~WindowedNotificationObserver() {} void WindowedNotificationObserver::Wait() { - if (waiting_for_ == NotificationService::AllSources()) { - LOG(FATAL) << "Wait called when monitoring all sources. You must use " - << "WaitFor in this case."; - } - - if (seen_) + if (seen_ || (waiting_for_ == NotificationService::AllSources() && + !sources_seen_.empty())) { return; + } running_ = true; ui_test_utils::RunMessageLoop(); @@ -956,7 +953,8 @@ void WindowedNotificationObserver::WaitFor(const NotificationSource& source) { void WindowedNotificationObserver::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { - if (waiting_for_ == source) { + if (waiting_for_ == source || + (running_ && waiting_for_ == NotificationService::AllSources())) { seen_ = true; if (running_) MessageLoopForUI::current()->Quit(); |