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

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

Issue 2613713005: Make ToolbarActionsModel own ComponentToolbarActionsFactory (Closed)
Patch Set: Created 3 years, 11 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
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 <memory> 5 #include <memory>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/extensions/browser_action_test_util.h" 9 #include "chrome/browser/extensions/browser_action_test_util.h"
10 #include "chrome/browser/extensions/extension_action_test_util.h" 10 #include "chrome/browser/extensions/extension_action_test_util.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE)); 121 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
122 122
123 menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0); 123 menu.ExecuteCommand(IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE, 0);
124 EXPECT_FALSE(menu.IsCommandIdChecked( 124 EXPECT_FALSE(menu.IsCommandIdChecked(
125 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE)); 125 IDC_MEDIA_ROUTER_CLOUD_SERVICES_TOGGLE));
126 } 126 }
127 127
128 TEST_F(MediaRouterContextualMenuUnitTest, ToggleAlwaysShowIconItem) { 128 TEST_F(MediaRouterContextualMenuUnitTest, ToggleAlwaysShowIconItem) {
129 MediaRouterContextualMenu menu(browser()); 129 MediaRouterContextualMenu menu(browser());
130 extensions::ComponentMigrationHelper* const component_migration_helper = 130 extensions::ComponentMigrationHelper* const component_migration_helper =
131 toolbar_actions_model()->component_migration_helper(); 131 toolbar_actions_model()->GetComponentMigrationHelper();
132 132
133 // Whether the option is checked should reflect the pref. 133 // Whether the option is checked should reflect the pref.
134 component_migration_helper->SetComponentActionPref( 134 component_migration_helper->SetComponentActionPref(
135 ComponentToolbarActionsFactory::kMediaRouterActionId, true); 135 ComponentToolbarActionsFactory::kMediaRouterActionId, true);
136 EXPECT_TRUE( 136 EXPECT_TRUE(
137 menu.IsCommandIdChecked(IDC_MEDIA_ROUTER_ALWAYS_SHOW_TOOLBAR_ACTION)); 137 menu.IsCommandIdChecked(IDC_MEDIA_ROUTER_ALWAYS_SHOW_TOOLBAR_ACTION));
138 138
139 component_migration_helper->SetComponentActionPref( 139 component_migration_helper->SetComponentActionPref(
140 ComponentToolbarActionsFactory::kMediaRouterActionId, false); 140 ComponentToolbarActionsFactory::kMediaRouterActionId, false);
141 EXPECT_FALSE( 141 EXPECT_FALSE(
142 menu.IsCommandIdChecked(IDC_MEDIA_ROUTER_ALWAYS_SHOW_TOOLBAR_ACTION)); 142 menu.IsCommandIdChecked(IDC_MEDIA_ROUTER_ALWAYS_SHOW_TOOLBAR_ACTION));
143 143
144 // Executing the option should toggle the pref. 144 // Executing the option should toggle the pref.
145 menu.ExecuteCommand(IDC_MEDIA_ROUTER_ALWAYS_SHOW_TOOLBAR_ACTION, 0); 145 menu.ExecuteCommand(IDC_MEDIA_ROUTER_ALWAYS_SHOW_TOOLBAR_ACTION, 0);
146 EXPECT_TRUE(component_migration_helper->GetComponentActionPref( 146 EXPECT_TRUE(component_migration_helper->GetComponentActionPref(
147 ComponentToolbarActionsFactory::kMediaRouterActionId)); 147 ComponentToolbarActionsFactory::kMediaRouterActionId));
148 148
149 menu.ExecuteCommand(IDC_MEDIA_ROUTER_ALWAYS_SHOW_TOOLBAR_ACTION, 0); 149 menu.ExecuteCommand(IDC_MEDIA_ROUTER_ALWAYS_SHOW_TOOLBAR_ACTION, 0);
150 EXPECT_FALSE(component_migration_helper->GetComponentActionPref( 150 EXPECT_FALSE(component_migration_helper->GetComponentActionPref(
151 ComponentToolbarActionsFactory::kMediaRouterActionId)); 151 ComponentToolbarActionsFactory::kMediaRouterActionId));
152 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698