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

Unified Diff: chrome/browser/ui/panels/test_panel_notification_observer.cc

Issue 10914242: Improve panel tests by properly waiting for expected conditions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/test_panel_notification_observer.cc
diff --git a/chrome/browser/ui/panels/test_panel_active_state_observer.cc b/chrome/browser/ui/panels/test_panel_notification_observer.cc
similarity index 56%
copy from chrome/browser/ui/panels/test_panel_active_state_observer.cc
copy to chrome/browser/ui/panels/test_panel_notification_observer.cc
index b96e547f73f55d0ee9b57e9ef89d084dd44ee734..efd679331456a3635c23090ac92389d1897208bf 100644
--- a/chrome/browser/ui/panels/test_panel_active_state_observer.cc
+++ b/chrome/browser/ui/panels/test_panel_notification_observer.cc
@@ -2,28 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/panels/test_panel_active_state_observer.h"
+#include "chrome/browser/ui/panels/test_panel_notification_observer.h"
-#include "chrome/browser/ui/panels/panel.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/notification_source.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
-PanelActiveStateObserver::PanelActiveStateObserver(
- Panel* panel,
- bool expect_active)
- : panel_(panel),
- expect_active_(expect_active),
- seen_(false),
+TestPanelNotificationObserver::TestPanelNotificationObserver(
+ int notification,
+ const content::NotificationSource& source)
+ : seen_(false),
running_(false) {
- registrar_.Add(this, chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS,
- content::Source<Panel>(panel));
+ registrar_.Add(this, notification, source);
}
-PanelActiveStateObserver::~PanelActiveStateObserver() {}
+TestPanelNotificationObserver::~TestPanelNotificationObserver() {}
-void PanelActiveStateObserver::Wait() {
+void TestPanelNotificationObserver::Wait() {
if (seen_ || AtExpectedState())
return;
@@ -33,11 +29,7 @@ void PanelActiveStateObserver::Wait() {
EXPECT_TRUE(seen_);
}
-bool PanelActiveStateObserver::AtExpectedState() {
- return panel_->IsActive() == expect_active_;
-}
-
-void PanelActiveStateObserver::Observe(
+void TestPanelNotificationObserver::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {

Powered by Google App Engine
This is Rietveld 408576698