summaryrefslogtreecommitdiffstats
path: root/chrome/test/base/ui_test_utils.cc
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-03 18:40:36 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-03 18:40:36 +0000
commit99a0e7ea2e8352630e5ef5bc39025b6e853fd767 (patch)
tree1fba90d32459b392cba1565e0eb3d305e9167aa5 /chrome/test/base/ui_test_utils.cc
parentba8f31c35143427524fecaa0ea579bc25a287815 (diff)
downloadchromium_src-99a0e7ea2e8352630e5ef5bc39025b6e853fd767.zip
chromium_src-99a0e7ea2e8352630e5ef5bc39025b6e853fd767.tar.gz
chromium_src-99a0e7ea2e8352630e5ef5bc39025b6e853fd767.tar.bz2
Revert 135167 - Simplify WindowedNotificationObserver now that WaitFor() is gone.
It broke SafeBrowsingBlockingPageTest.MalwareRedirectInIFrameCanceled. Wouldn't surprise me if the bug is in the test, but don't have time to investigate it now. Sample failure: Note: Google Test filter = SafeBrowsingBlockingPageTest.MalwareRedirectInIFrameCanceled [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from SafeBrowsingBlockingPageTest, where TypeParam = [ RUN ] SafeBrowsingBlockingPageTest.MalwareRedirectInIFrameCanceled [27529:27529:0503/104834:550756638:WARNING:zygote_host_impl_linux.cc(154)] Running without the SUID sandbox! See http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on. chrome/test/base/ui_test_utils.cc:976: Failure Value of: seen_ Actual: false Expected: true [ FAILED ] SafeBrowsingBlockingPageTest.MalwareRedirectInIFrameCanceled, where TypeParam = and GetParam() = (1893 ms) [----------] 1 test from SafeBrowsingBlockingPageTest (1894 ms total) BUG=none TEST=none Review URL: http://codereview.chromium.org/10315004 TBR=bauerb@chromium.org Review URL: https://chromiumcodereview.appspot.com/10316023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135182 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/base/ui_test_utils.cc')
-rw-r--r--chrome/test/base/ui_test_utils.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index ea8e8a2..272f4a0 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -10,7 +10,6 @@
#include <vector>
-#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/callback.h"
@@ -961,28 +960,36 @@ WindowedNotificationObserver::WindowedNotificationObserver(
int notification_type,
const content::NotificationSource& source)
: seen_(false),
- running_(false) {
- registrar_.Add(this, notification_type, source);
+ running_(false),
+ waiting_for_(source) {
+ registrar_.Add(this, notification_type, waiting_for_);
}
WindowedNotificationObserver::~WindowedNotificationObserver() {}
void WindowedNotificationObserver::Wait() {
- if (seen_)
+ if (seen_ || (waiting_for_ == content::NotificationService::AllSources() &&
+ !sources_seen_.empty())) {
return;
+ }
- AutoReset<bool> auto_reset(&running_, true);
+ running_ = true;
ui_test_utils::RunMessageLoop();
- EXPECT_TRUE(seen_);
+ running_ = false;
}
void WindowedNotificationObserver::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- seen_ = true;
- if (running_)
- MessageLoopForUI::current()->Quit();
+ if (waiting_for_ == source ||
+ (running_ && waiting_for_ == content::NotificationService::AllSources())) {
+ seen_ = true;
+ if (running_)
+ MessageLoopForUI::current()->Quit();
+ } else {
+ sources_seen_.insert(source.map_key());
+ }
}
WindowedTabAddedNotificationObserver::WindowedTabAddedNotificationObserver(