| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_context_menu_model.h" | 5 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 // We shouldn't go above the limit of top-level items. | 336 // We shouldn't go above the limit of top-level items. |
| 337 EXPECT_EQ(api::context_menus::ACTION_MENU_TOP_LEVEL_LIMIT, | 337 EXPECT_EQ(api::context_menus::ACTION_MENU_TOP_LEVEL_LIMIT, |
| 338 CountExtensionItems(*builder.BuildMenu())); | 338 CountExtensionItems(*builder.BuildMenu())); |
| 339 } | 339 } |
| 340 | 340 |
| 341 // Test that the "show" and "hide" menu items appear correctly in the extension | 341 // Test that the "show" and "hide" menu items appear correctly in the extension |
| 342 // context menu without the toolbar redesign. | 342 // context menu without the toolbar redesign. |
| 343 TEST_F(ExtensionContextMenuModelTest, ExtensionContextMenuShowAndHideLegacy) { | 343 TEST_F(ExtensionContextMenuModelTest, ExtensionContextMenuShowAndHideLegacy) { |
| 344 // Start with the toolbar redesign disabled. | 344 // Start with the toolbar redesign disabled. |
| 345 std::unique_ptr<FeatureSwitch::ScopedOverride> toolbar_redesign_override( | 345 FeatureSwitch::ScopedOverride enable_media_router( |
| 346 new FeatureSwitch::ScopedOverride( | 346 extensions::FeatureSwitch::media_router(), false); |
| 347 FeatureSwitch::extension_action_redesign(), false)); | 347 FeatureSwitch::ScopedOverride toolbar_redesign_override( |
| 348 FeatureSwitch::extension_action_redesign(), false); |
| 348 | 349 |
| 349 InitializeEmptyExtensionService(); | 350 InitializeEmptyExtensionService(); |
| 350 Browser* browser = GetBrowser(); | 351 Browser* browser = GetBrowser(); |
| 351 extension_action_test_util::CreateToolbarModelForProfile(profile()); | 352 extension_action_test_util::CreateToolbarModelForProfile(profile()); |
| 352 | 353 |
| 353 const Extension* page_action = AddExtension( | 354 const Extension* page_action = AddExtension( |
| 354 "page_action_extension", manifest_keys::kPageAction, Manifest::INTERNAL); | 355 "page_action_extension", manifest_keys::kPageAction, Manifest::INTERNAL); |
| 355 const Extension* browser_action = | 356 const Extension* browser_action = |
| 356 AddExtension("browser_action_extension", manifest_keys::kBrowserAction, | 357 AddExtension("browser_action_extension", manifest_keys::kBrowserAction, |
| 357 Manifest::INTERNAL); | 358 Manifest::INTERNAL); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 "no_action", nullptr, Manifest::INTERNAL); | 708 "no_action", nullptr, Manifest::INTERNAL); |
| 708 ExtensionContextMenuModel menu(no_action, GetBrowser(), | 709 ExtensionContextMenuModel menu(no_action, GetBrowser(), |
| 709 ExtensionContextMenuModel::VISIBLE, nullptr); | 710 ExtensionContextMenuModel::VISIBLE, nullptr); |
| 710 int inspect_popup_index = | 711 int inspect_popup_index = |
| 711 menu.GetIndexOfCommandId(ExtensionContextMenuModel::INSPECT_POPUP); | 712 menu.GetIndexOfCommandId(ExtensionContextMenuModel::INSPECT_POPUP); |
| 712 EXPECT_EQ(-1, inspect_popup_index); | 713 EXPECT_EQ(-1, inspect_popup_index); |
| 713 } | 714 } |
| 714 } | 715 } |
| 715 | 716 |
| 716 } // namespace extensions | 717 } // namespace extensions |
| OLD | NEW |