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

Side by Side Diff: chrome/browser/ui/toolbar/media_router_contextual_menu_unittest.cc

Issue 2260873003: Revert of Fix MediaRouterContextualMenuUnitTest (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 17 matching lines...) Expand all
28 } 28 }
29 29
30 void TearDown() override { 30 void TearDown() override {
31 action_.reset(); 31 action_.reset();
32 browser_action_test_util_.reset(); 32 browser_action_test_util_.reset();
33 BrowserWithTestWindowTest::TearDown(); 33 BrowserWithTestWindowTest::TearDown();
34 } 34 }
35 35
36 SigninManagerBase* signin_manager() { return signin_manager_; } 36 SigninManagerBase* signin_manager() { return signin_manager_; }
37 ui::SimpleMenuModel* model() { return model_; } 37 ui::SimpleMenuModel* model() { return model_; }
38 MediaRouterAction* action() { return action_.get(); }
39 38
40 private: 39 private:
41 std::unique_ptr<BrowserActionTestUtil> browser_action_test_util_; 40 std::unique_ptr<BrowserActionTestUtil> browser_action_test_util_;
42 std::unique_ptr<MediaRouterAction> action_; 41 std::unique_ptr<MediaRouterAction> action_;
43 SigninManagerBase* signin_manager_; 42 SigninManagerBase* signin_manager_;
44 ui::SimpleMenuModel* model_; 43 ui::SimpleMenuModel* model_;
45 44
46 DISALLOW_COPY_AND_ASSIGN(MediaRouterContextualMenuUnitTest); 45 DISALLOW_COPY_AND_ASSIGN(MediaRouterContextualMenuUnitTest);
47 }; 46 };
48 47
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 EXPECT_TRUE(model()->IsVisibleAt(i)); 89 EXPECT_TRUE(model()->IsVisibleAt(i));
91 } 90 }
92 } 91 }
93 92
94 #if defined(GOOGLE_CHROME_BUILD) 93 #if defined(GOOGLE_CHROME_BUILD)
95 // Tests whether the cloud services item is correctly toggled. This menu item 94 // Tests whether the cloud services item is correctly toggled. This menu item
96 // is only availble on official Chrome builds. 95 // is only availble on official Chrome builds.
97 TEST_F(MediaRouterContextualMenuUnitTest, ToggleCloudServicesItem) { 96 TEST_F(MediaRouterContextualMenuUnitTest, ToggleCloudServicesItem) {
98 // The Media Router Action has a getter for the model, but not the delegate. 97 // The Media Router Action has a getter for the model, but not the delegate.
99 // Create the MediaRouterContextualMenu ui::SimpleMenuModel::Delegate here. 98 // Create the MediaRouterContextualMenu ui::SimpleMenuModel::Delegate here.
100 MediaRouterContextualMenu menu(browser(), action()); 99 MediaRouterContextualMenu menu(browser());
101 100
102 // Set up an authenticated account such that the cloud services menu item is 101 // Set up an authenticated account such that the cloud services menu item is
103 // surfaced. Whether or not it is surfaced is tested in the "Basic" test. 102 // surfaced. Whether or not it is surfaced is tested in the "Basic" test.
104 signin_manager()->SetAuthenticatedAccountInfo("foo@bar.com", "password"); 103 signin_manager()->SetAuthenticatedAccountInfo("foo@bar.com", "password");
105 104
106 // By default, the command is not checked. 105 // By default, the command is not checked.
107 EXPECT_FALSE(menu.IsCommandIdChecked( 106 EXPECT_FALSE(menu.IsCommandIdChecked(
108 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE)); 107 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
109 108
110 menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0); 109 menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0);
111 EXPECT_TRUE(menu.IsCommandIdChecked( 110 EXPECT_TRUE(menu.IsCommandIdChecked(
112 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE)); 111 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
113 112
114 menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0); 113 menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0);
115 EXPECT_FALSE(menu.IsCommandIdChecked( 114 EXPECT_FALSE(menu.IsCommandIdChecked(
116 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE)); 115 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
117 } 116 }
118 #endif // GOOGLE_CHROME_BUILD 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