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

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

Issue 2190223002: [Media Router Contextual Menu] Test 'checked' state of cloud services item. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per msw@'s comments. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc
diff --git a/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc b/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc
index 062151ba44d87125a5e9cf95052c671665edf1a7..add326148d8fdc0946b0cd0b042734b593e8c412 100644
--- a/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc
+++ b/chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc
@@ -89,3 +89,29 @@ TEST_F(MediaRouterContextualMenuUnitTest, Basic) {
EXPECT_TRUE(model()->IsVisibleAt(i));
}
}
+
+#if defined(GOOGLE_CHROME_BUILD)
+// Tests whether the cloud services item is correctly toggled. This menu item
+// is only availble on official Chrome builds.
+TEST_F(MediaRouterContextualMenuUnitTest, ToggleCloudServicesItem) {
+ // The Media Router Action has a getter for the model, but not the delegate.
+ // Create the MediaRouterContextualMenu ui::SimpleMenuModel::Delegate here.
+ MediaRouterContextualMenu menu(browser());
+
+ // Set up an authenticated account such that the cloud services menu item is
+ // surfaced. Whether or not it is surfaced is tested in the "Basic" test.
+ signin_manager()->SetAuthenticatedAccountInfo("foo@bar.com", "password");
+
+ // By default, the command is not checked.
+ EXPECT_FALSE(menu.IsCommandIdChecked(
+ IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
+
+ menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0);
+ EXPECT_TRUE(menu.IsCommandIdChecked(
+ IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
+
+ menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0);
+ EXPECT_FALSE(menu.IsCommandIdChecked(
+ IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
+}
+#endif // GOOGLE_CHROME_BUILD
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698