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

Unified Diff: chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc

Issue 2469013003: Keep the toolbar overflow menu the same when removing a component action (Closed)
Patch Set: Created 4 years, 1 month 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/toolbar/toolbar_actions_model.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/toolbar/toolbar_actions_model_unittest.cc
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc
index f0f3b4bebb1bf341ede5479a3b2b153d77252048..ae08f5555aeb2391e4fcaa12ff5581870f139b8a 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc
+++ b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc
@@ -1430,6 +1430,32 @@ TEST_F(ToolbarActionsModelUnitTest,
EXPECT_EQ(browser_action_c()->id(), GetActionIdAtIndex(1u));
}
+TEST_F(ToolbarActionsModelUnitTest, AddAndRemoveComponentActionWithOVerflow) {
+ Init();
+ // Add three extension actions: A, B, C.
+ ASSERT_TRUE(AddBrowserActionExtensions());
+ EXPECT_EQ(3u, num_toolbar_items());
+
+ // Hide the last icon: A, B, [C].
+ toolbar_model()->SetVisibleIconCount(2);
+ EXPECT_EQ(2u, toolbar_model()->visible_icon_count());
+ EXPECT_EQ(browser_action_c()->id(), GetActionIdAtIndex(2u));
+
+ // Add a component action, CA. Now the icons should be: A, B, CA, [C].
+ toolbar_model()->AddComponentAction(component_action_id());
+ EXPECT_EQ(4u, num_toolbar_items());
+ EXPECT_EQ(3u, toolbar_model()->visible_icon_count());
+ EXPECT_EQ(component_action_id(), GetActionIdAtIndex(2u));
+ EXPECT_EQ(browser_action_c()->id(), GetActionIdAtIndex(3u));
+
+ // Remove the component action. Extension C should stay in the overflow.
+ // The icons should be: A, B, [C].
+ toolbar_model()->RemoveComponentAction(component_action_id());
+ EXPECT_EQ(3u, num_toolbar_items());
+ EXPECT_EQ(2u, toolbar_model()->visible_icon_count());
+ EXPECT_EQ(browser_action_c()->id(), GetActionIdAtIndex(2u));
+}
+
TEST_F(ToolbarActionsModelUnitTest,
TestUninstallVisibleExtensionDoesntBringOutOther) {
Init();
« no previous file with comments | « chrome/browser/ui/toolbar/toolbar_actions_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698