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

Unified Diff: chrome/browser/ui/panels/test_panel_strip_squeeze_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
« no previous file with comments | « chrome/browser/ui/panels/test_panel_strip_squeeze_observer.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/test_panel_strip_squeeze_observer.cc
diff --git a/chrome/browser/ui/panels/test_panel_strip_squeeze_observer.cc b/chrome/browser/ui/panels/test_panel_strip_squeeze_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..463a35fab28e3b1d341ad48b1ca37c9dbb687d06
--- /dev/null
+++ b/chrome/browser/ui/panels/test_panel_strip_squeeze_observer.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// 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_strip_squeeze_observer.h"
+
+#include "chrome/browser/ui/panels/docked_panel_strip.h"
+#include "chrome/browser/ui/panels/panel.h"
+#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/notification_source.h"
+
+PanelStripSqueezeObserver::PanelStripSqueezeObserver(
+ DockedPanelStrip* strip, Panel* active_panel)
+ : TestPanelNotificationObserver(
+ chrome::NOTIFICATION_PANEL_STRIP_UPDATED,
+ content::Source<PanelStrip>(strip)),
+ panel_strip_(strip),
+ active_panel_(active_panel) {
+}
+
+PanelStripSqueezeObserver::~PanelStripSqueezeObserver() {}
+
+bool PanelStripSqueezeObserver::IsSqueezed(Panel* panel) {
+ return panel->GetBounds().width() < panel->GetRestoredBounds().width();
+}
+
+bool PanelStripSqueezeObserver::AtExpectedState() {
+ const DockedPanelStrip::Panels& panels = panel_strip_->panels();
+ for (DockedPanelStrip::Panels::const_iterator iter = panels.begin();
+ iter != panels.end(); ++iter) {
+ if (*iter == active_panel_) {
+ if (IsSqueezed(*iter))
+ return false;
+ } else if (!IsSqueezed(*iter)) {
+ return false;
+ }
+ }
+ return true;
+}
« no previous file with comments | « chrome/browser/ui/panels/test_panel_strip_squeeze_observer.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698