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

Side by Side 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: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "chrome/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/extensions/browser_action_test_util.h" 7 #include "chrome/browser/extensions/browser_action_test_util.h"
8 #include "chrome/browser/signin/fake_signin_manager_builder.h" 8 #include "chrome/browser/signin/fake_signin_manager_builder.h"
9 #include "chrome/browser/signin/signin_manager_factory.h" 9 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/browser/ui/toolbar/media_router_action.h" 10 #include "chrome/browser/ui/toolbar/media_router_action.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 signin_manager()->SetAuthenticatedAccountInfo("foo@bar.com", "password"); 82 signin_manager()->SetAuthenticatedAccountInfo("foo@bar.com", "password");
83 83
84 // Run the same checks as before. All existing menu items should be now 84 // Run the same checks as before. All existing menu items should be now
85 // enabled and visible. 85 // enabled and visible.
86 EXPECT_EQ(model()->GetItemCount(), expected_number_items); 86 EXPECT_EQ(model()->GetItemCount(), expected_number_items);
87 for (int i = 0; i < expected_number_items; i++) { 87 for (int i = 0; i < expected_number_items; i++) {
88 EXPECT_TRUE(model()->IsEnabledAt(i)); 88 EXPECT_TRUE(model()->IsEnabledAt(i));
89 EXPECT_TRUE(model()->IsVisibleAt(i)); 89 EXPECT_TRUE(model()->IsVisibleAt(i));
90 } 90 }
91 } 91 }
92
93 #if defined(GOOGLE_CHROME_BUILD)
94 // Tests whether the cloud services item is correctly toggled. This menu item
95 // is only availble on official Chrome builds.
96 TEST_F(MediaRouterContextualMenuUnitTest, ToggleCloudServicesItem) {
97 // The Media Router Action has a getter for the model, but not the delegate.
98 // Create the delegate for this test.
msw 2016/07/29 02:31:50 nit: Create the MediaRouterContextualMenu ui::Simp
apacible 2016/07/29 15:19:41 Done.
99 MediaRouterContextualMenu menu(browser());
100
101 // Set up an authenticated account such that the cloud services menu item is
102 // surfaced. Whether or not it is surfaced is tested in the "Basic" test.
103 signin_manager()->SetAuthenticatedAccountInfo("foo@bar.com", "password");
104
105 // By default, the command is not checked.
106 EXPECT_FALSE(menu.IsCommandIdChecked(
107 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
108
109 menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0);
110 EXPECT_TRUE(menu.IsCommandIdChecked(
111 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
112
113 menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0);
114 EXPECT_FALSE(menu.IsCommandIdChecked(
115 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
116 }
117 #endif // GOOGLE_CHROME_BUILD
OLDNEW
« 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