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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.cc

Issue 2008763002: [Extensions UI] Remove all traces of the chevron (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.h" 5 #include "chrome/browser/ui/toolbar/toolbar_actions_bar_unittest.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 EXPECT_EQ(3u, toolbar_actions_bar()->GetIconCount()); 217 EXPECT_EQ(3u, toolbar_actions_bar()->GetIconCount());
218 // Check the widths. IconWidth(true) includes the spacing to the left of 218 // Check the widths. IconWidth(true) includes the spacing to the left of
219 // each icon and |item_spacing| accounts for the spacing to the right 219 // each icon and |item_spacing| accounts for the spacing to the right
220 // of the rightmost icon. 220 // of the rightmost icon.
221 int expected_width = 221 int expected_width =
222 3 * ToolbarActionsBar::IconWidth(true) + platform_settings.item_spacing; 222 3 * ToolbarActionsBar::IconWidth(true) + platform_settings.item_spacing;
223 EXPECT_EQ(expected_width, toolbar_actions_bar()->GetPreferredSize().width()); 223 EXPECT_EQ(expected_width, toolbar_actions_bar()->GetPreferredSize().width());
224 // Since all icons are showing, the current width should be the max width. 224 // Since all icons are showing, the current width should be the max width.
225 int maximum_width = expected_width; 225 int maximum_width = expected_width;
226 EXPECT_EQ(maximum_width, toolbar_actions_bar()->GetMaximumWidth()); 226 EXPECT_EQ(maximum_width, toolbar_actions_bar()->GetMaximumWidth());
227 // The minimum width should be just enough for the chevron to be displayed 227 // The minimum width should be be non-zero (as long as there are any icons) so
228 // along with left and right padding. 228 // we can render the grippy to allow the user to drag to adjust the width.
229 int minimum_width = 2 * platform_settings.item_spacing + 229 int minimum_width = platform_settings.item_spacing;
230 toolbar_actions_bar()->delegate_for_test()->
231 GetChevronWidth();
232 EXPECT_EQ(minimum_width, toolbar_actions_bar()->GetMinimumWidth()); 230 EXPECT_EQ(minimum_width, toolbar_actions_bar()->GetMinimumWidth());
233 231
234 // Test the connection between the ToolbarActionsBar and the model by 232 // Test the connection between the ToolbarActionsBar and the model by
235 // adjusting the visible count. 233 // adjusting the visible count.
236 toolbar_model()->SetVisibleIconCount(2u); 234 toolbar_model()->SetVisibleIconCount(2u);
237 EXPECT_EQ(2u, toolbar_actions_bar()->GetIconCount()); 235 EXPECT_EQ(2u, toolbar_actions_bar()->GetIconCount());
238 236
239 // The current width should now be enough for two icons, and the chevron. 237 // The current width should now be enough for two icons.
240 // IconWidth(true) includes the spacing to the left of each icon and 238 // IconWidth(true) includes the spacing to the left of each icon and
241 // |item_spacing| accounts for the spacing to the right of the rightmost 239 // |item_spacing| accounts for the spacing to the right of the rightmost
242 // icon. 240 // icon.
243 expected_width = 2 * ToolbarActionsBar::IconWidth(true) + 241 expected_width = 2 * ToolbarActionsBar::IconWidth(true) +
244 platform_settings.item_spacing + 242 platform_settings.item_spacing;
245 toolbar_actions_bar()->delegate_for_test()->
246 GetChevronWidth();
247 EXPECT_EQ(expected_width, toolbar_actions_bar()->GetPreferredSize().width()); 243 EXPECT_EQ(expected_width, toolbar_actions_bar()->GetPreferredSize().width());
248 // The maximum and minimum widths should have remained constant (since we have 244 // The maximum and minimum widths should have remained constant (since we have
249 // the same number of actions). 245 // the same number of actions).
250 EXPECT_EQ(maximum_width, toolbar_actions_bar()->GetMaximumWidth()); 246 EXPECT_EQ(maximum_width, toolbar_actions_bar()->GetMaximumWidth());
251 EXPECT_EQ(minimum_width, toolbar_actions_bar()->GetMinimumWidth()); 247 EXPECT_EQ(minimum_width, toolbar_actions_bar()->GetMinimumWidth());
252 248
253 // Test drag-and-drop logic. 249 // Test drag-and-drop logic.
254 const char kExtension0[] = "extension 0"; 250 const char kExtension0[] = "extension 0";
255 const char kExtension1[] = "extension 1"; 251 const char kExtension1[] = "extension 1";
256 const char kExtension2[] = "extension 2"; 252 const char kExtension2[] = "extension 2";
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 extensions::extension_action_test_util::BROWSER_ACTION); 591 extensions::extension_action_test_util::BROWSER_ACTION);
596 toolbar_model()->SetVisibleIconCount(0u); 592 toolbar_model()->SetVisibleIconCount(0u);
597 { 593 {
598 base::RunLoop run_loop; 594 base::RunLoop run_loop;
599 toolbar_actions_bar()->PopOutAction(action, true, run_loop.QuitClosure()); 595 toolbar_actions_bar()->PopOutAction(action, true, run_loop.QuitClosure());
600 run_loop.Run(); 596 run_loop.Run();
601 } 597 }
602 EXPECT_EQ(1u, toolbar_actions_bar()->GetIconCount()); 598 EXPECT_EQ(1u, toolbar_actions_bar()->GetIconCount());
603 EXPECT_TRUE(toolbar_actions_bar()->NeedsOverflow()); 599 EXPECT_TRUE(toolbar_actions_bar()->NeedsOverflow());
604 } 600 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_actions_bar_delegate.h ('k') | chrome/browser/ui/views/toolbar/browser_actions_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698