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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/panels/test_panel_strip_squeeze_observer.h"
6
7 #include "chrome/browser/ui/panels/docked_panel_strip.h"
8 #include "chrome/browser/ui/panels/panel.h"
9 #include "chrome/common/chrome_notification_types.h"
10 #include "content/public/browser/notification_source.h"
11
12 PanelStripSqueezeObserver::PanelStripSqueezeObserver(
13 DockedPanelStrip* strip, Panel* active_panel)
14 : TestPanelNotificationObserver(
15 chrome::NOTIFICATION_PANEL_STRIP_UPDATED,
16 content::Source<PanelStrip>(strip)),
17 panel_strip_(strip),
18 active_panel_(active_panel) {
19 }
20
21 PanelStripSqueezeObserver::~PanelStripSqueezeObserver() {}
22
23 bool PanelStripSqueezeObserver::IsSqueezed(Panel* panel) {
24 return panel->GetBounds().width() < panel->GetRestoredBounds().width();
25 }
26
27 bool PanelStripSqueezeObserver::AtExpectedState() {
28 const DockedPanelStrip::Panels& panels = panel_strip_->panels();
29 for (DockedPanelStrip::Panels::const_iterator iter = panels.begin();
30 iter != panels.end(); ++iter) {
31 if (*iter == active_panel_) {
32 if (IsSqueezed(*iter))
33 return false;
34 } else if (!IsSqueezed(*iter)) {
35 return false;
36 }
37 }
38 return true;
39 }
OLDNEW
« 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