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

Unified Diff: chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc

Issue 2721953002: [Media Router] Add "Hide in menu/Show in toolbar" option to Cast toolbar icon (Closed)
Patch Set: Created 3 years, 10 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
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..1be04ac58119821a7a3479ebdf1005164c879988 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, HideActionInOverflow) {
apacible 2017/03/02 02:02:57 nit: s/HideActionInOverflow/UpdateActionLocation ?
takumif 2017/03/03 00:10:48 Done.
+ 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

Powered by Google App Engine
This is Rietveld 408576698