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