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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc

Issue 656033007: Minor cleanup in BookmarkBarView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 6 years, 2 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/views/bookmarks/bookmark_bar_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
index f4d55c774b3ff200794ad0676af83e5e906737d3..197f926df1429fa3cafa694f5929dfc1bbff1f3a 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
@@ -283,29 +283,20 @@ class BookmarkBarViewEventTestBase : public ViewEventTestBase {
AddTestData(CreateBigMenu());
// Calculate the preferred size so that one button doesn't fit, which
- // triggers the overflow button to appear.
- //
- // BookmarkBarView::Layout does nothing if the parent is NULL and
- // GetPreferredSize hard codes a width of 1. For that reason we add the
- // BookmarkBarView to a dumby view as the parent.
+ // triggers the overflow button to appear. We have to do this incrementally
+ // as there isn't a good way to determine the point at which the overflow
+ // button is shown.
//
// This code looks a bit hacky, but I've written it so that it shouldn't
// be dependant upon any of the layout code in BookmarkBarView. Instead
// we brute force search for a size that triggers the overflow button.
- views::View tmp_parent;
-
- tmp_parent.AddChildView(bb_view_.get());
-
bb_view_pref_ = bb_view_->GetPreferredSize();
bb_view_pref_.set_width(1000);
- views::LabelButton* button = GetBookmarkButton(6);
- while (button->visible()) {
+ do {
bb_view_pref_.set_width(bb_view_pref_.width() - 25);
bb_view_->SetBounds(0, 0, bb_view_pref_.width(), bb_view_pref_.height());
bb_view_->Layout();
- }
-
- tmp_parent.RemoveChildView(bb_view_.get());
+ } while (GetBookmarkButton(6)->visible());
ViewEventTestBase::SetUp();
}
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698