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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc

Issue 1228213003: Just set borders once when creating a views::LabelButton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix BookmarkBarViewTest and GlobalErrorServiceBrowserTest Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 local_state_.reset(new ScopedTestingLocalState( 280 local_state_.reset(new ScopedTestingLocalState(
281 TestingBrowserProcess::GetGlobal())); 281 TestingBrowserProcess::GetGlobal()));
282 model_->ClearStore(); 282 model_->ClearStore();
283 283
284 bb_view_.reset(new BookmarkBarView(browser_.get(), NULL)); 284 bb_view_.reset(new BookmarkBarView(browser_.get(), NULL));
285 bb_view_->set_owned_by_client(); 285 bb_view_->set_owned_by_client();
286 bb_view_->SetPageNavigator(&navigator_); 286 bb_view_->SetPageNavigator(&navigator_);
287 287
288 AddTestData(CreateBigMenu()); 288 AddTestData(CreateBigMenu());
289 289
290 // Create the Widget. This ensures the following calculation correctly
msw 2015/07/10 18:40:07 Hmm, where does the view get added to the widget?
tapted 2015/07/13 07:41:21 Yeah, this test harness is a bit crafty :). ViewEv
291 // applies borders which may be derived from the Widget's NativeTheme.
292 ViewEventTestBase::SetUp();
msw 2015/07/10 18:40:07 nit: maybe call this at the top of the function?
tapted 2015/07/13 07:41:21 (see above)
293
290 // Calculate the preferred size so that one button doesn't fit, which 294 // Calculate the preferred size so that one button doesn't fit, which
291 // triggers the overflow button to appear. We have to do this incrementally 295 // triggers the overflow button to appear. We have to do this incrementally
292 // as there isn't a good way to determine the point at which the overflow 296 // as there isn't a good way to determine the point at which the overflow
293 // button is shown. 297 // button is shown.
294 // 298 //
295 // This code looks a bit hacky, but I've written it so that it shouldn't 299 // This code looks a bit hacky, but I've written it so that it shouldn't
296 // be dependant upon any of the layout code in BookmarkBarView. Instead 300 // be dependant upon any of the layout code in BookmarkBarView. Instead
297 // we brute force search for a size that triggers the overflow button. 301 // we brute force search for a size that triggers the overflow button.
298 bb_view_pref_ = bb_view_->GetPreferredSize(); 302 bb_view_pref_ = bb_view_->GetPreferredSize();
299 bb_view_pref_.set_width(1000); 303 bb_view_pref_.set_width(1000);
300 do { 304 do {
301 bb_view_pref_.set_width(bb_view_pref_.width() - 25); 305 bb_view_pref_.set_width(bb_view_pref_.width() - 25);
302 bb_view_->SetBounds(0, 0, bb_view_pref_.width(), bb_view_pref_.height()); 306 bb_view_->SetBounds(0, 0, bb_view_pref_.width(), bb_view_pref_.height());
303 bb_view_->Layout(); 307 bb_view_->Layout();
304 } while (GetBookmarkButton(6)->visible()); 308 } while (GetBookmarkButton(6)->visible());
305 309 window_->SetSize(GetPreferredSize());
msw 2015/07/10 18:40:07 why is this needed now?
tapted 2015/07/13 07:41:22 (tl;dr "moved" this to the GetPreferredSize() test
306 ViewEventTestBase::SetUp();
307 } 310 }
308 311
309 void TearDown() override { 312 void TearDown() override {
310 // Destroy everything, then run the message loop to ensure we delete all 313 // Destroy everything, then run the message loop to ensure we delete all
311 // Tasks and fully shut down. 314 // Tasks and fully shut down.
312 browser_->tab_strip_model()->CloseAllTabs(); 315 browser_->tab_strip_model()->CloseAllTabs();
313 bb_view_.reset(); 316 bb_view_.reset();
314 browser_.reset(); 317 browser_.reset();
315 profile_.reset(); 318 profile_.reset();
316 319
(...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 }; 2058 };
2056 2059
2057 #if defined(OS_WIN) 2060 #if defined(OS_WIN)
2058 // This test times out on Windows. TODO(pkotwicz): Find out why. 2061 // This test times out on Windows. TODO(pkotwicz): Find out why.
2059 #define MAYBE_CloseSourceBrowserDuringDrag DISABLED_CloseSourceBrowserDuringDrag 2062 #define MAYBE_CloseSourceBrowserDuringDrag DISABLED_CloseSourceBrowserDuringDrag
2060 #else 2063 #else
2061 #define MAYBE_CloseSourceBrowserDuringDrag CloseSourceBrowserDuringDrag 2064 #define MAYBE_CloseSourceBrowserDuringDrag CloseSourceBrowserDuringDrag
2062 #endif 2065 #endif
2063 2066
2064 VIEW_TEST(BookmarkBarViewTest22, MAYBE_CloseSourceBrowserDuringDrag) 2067 VIEW_TEST(BookmarkBarViewTest22, MAYBE_CloseSourceBrowserDuringDrag)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/global_error_bubble_view.cc » ('j') | ui/views/controls/button/blue_button_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698