Index: chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc |
diff --git a/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc b/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc |
index b867e61ab8e4ccbc5f81c4088c2f6cf52faa5dbb..a8133e709992dddac58c0d3ecbe8400023dda9fc 100644 |
--- a/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc |
+++ b/chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc |
@@ -89,6 +89,11 @@ class MediaRouterUIBrowserTest : public InProcessBrowserTest { |
->action(); |
} |
+ ui::SimpleMenuModel* GetActionContextMenu() { |
+ return static_cast<ui::SimpleMenuModel*>( |
+ GetMediaRouterAction()->GetContextMenu()); |
+ } |
+ |
void ExecuteMediaRouterAction(AppMenuButton* app_menu_button) { |
EXPECT_TRUE(app_menu_button->IsMenuShowing()); |
GetMediaRouterAction()->ExecuteAction(true); |
@@ -324,4 +329,26 @@ IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest, |
EXPECT_TRUE(ActionExists()); |
} |
+IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest, UpdateActionLocation) { |
+ SetAlwaysShowActionPref(true); |
+ |
+ // Get the index for "Hide in Chrome menu" / "Show in toolbar" menu item. |
+ const int command_index = GetActionContextMenu()->GetIndexOfCommandId( |
+ IDC_MEDIA_ROUTER_SHOW_IN_TOOLBAR); |
+ |
+ // Start out with the action visible on the main bar. |
+ EXPECT_TRUE( |
+ toolbar_actions_bar_->IsActionVisibleOnMainBar(GetMediaRouterAction())); |
+ GetActionContextMenu()->ActivatedAt(command_index); |
+ |
+ // The action should get hidden in the overflow menu. |
+ EXPECT_FALSE( |
+ toolbar_actions_bar_->IsActionVisibleOnMainBar(GetMediaRouterAction())); |
+ GetActionContextMenu()->ActivatedAt(command_index); |
+ |
+ // The action should be back on the main bar. |
+ EXPECT_TRUE( |
+ toolbar_actions_bar_->IsActionVisibleOnMainBar(GetMediaRouterAction())); |
+} |
+ |
} // namespace media_router |