| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 318 |
| 319 // We shouldn't go above the limit of top-level items. | 319 // We shouldn't go above the limit of top-level items. |
| 320 EXPECT_EQ(api::context_menus::ACTION_MENU_TOP_LEVEL_LIMIT, | 320 EXPECT_EQ(api::context_menus::ACTION_MENU_TOP_LEVEL_LIMIT, |
| 321 CountExtensionItems(*builder.BuildMenu())); | 321 CountExtensionItems(*builder.BuildMenu())); |
| 322 } | 322 } |
| 323 | 323 |
| 324 // Test that the "show" and "hide" menu items appear correctly in the extension | 324 // Test that the "show" and "hide" menu items appear correctly in the extension |
| 325 // context menu without the toolbar redesign. | 325 // context menu without the toolbar redesign. |
| 326 TEST_F(ExtensionContextMenuModelTest, ExtensionContextMenuShowAndHideLegacy) { | 326 TEST_F(ExtensionContextMenuModelTest, ExtensionContextMenuShowAndHideLegacy) { |
| 327 // Start with the toolbar redesign disabled. | 327 // Start with the toolbar redesign disabled. |
| 328 std::unique_ptr<FeatureSwitch::ScopedOverride> toolbar_redesign_override( | 328 FeatureSwitch::ScopedOverride enable_media_router( |
| 329 new FeatureSwitch::ScopedOverride( | 329 extensions::FeatureSwitch::media_router(), false); |
| 330 FeatureSwitch::extension_action_redesign(), false)); | 330 FeatureSwitch::ScopedOverride toolbar_redesign_override( |
| 331 FeatureSwitch::extension_action_redesign(), false); |
| 331 | 332 |
| 332 InitializeEmptyExtensionService(); | 333 InitializeEmptyExtensionService(); |
| 333 Browser* browser = GetBrowser(); | 334 Browser* browser = GetBrowser(); |
| 334 extension_action_test_util::CreateToolbarModelForProfile(profile()); | 335 extension_action_test_util::CreateToolbarModelForProfile(profile()); |
| 335 | 336 |
| 336 const Extension* page_action = AddExtension( | 337 const Extension* page_action = AddExtension( |
| 337 "page_action_extension", manifest_keys::kPageAction, Manifest::INTERNAL); | 338 "page_action_extension", manifest_keys::kPageAction, Manifest::INTERNAL); |
| 338 const Extension* browser_action = | 339 const Extension* browser_action = |
| 339 AddExtension("browser_action_extension", manifest_keys::kBrowserAction, | 340 AddExtension("browser_action_extension", manifest_keys::kBrowserAction, |
| 340 Manifest::INTERNAL); | 341 Manifest::INTERNAL); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 "no_action", nullptr, Manifest::INTERNAL); | 691 "no_action", nullptr, Manifest::INTERNAL); |
| 691 ExtensionContextMenuModel menu(no_action, GetBrowser(), | 692 ExtensionContextMenuModel menu(no_action, GetBrowser(), |
| 692 ExtensionContextMenuModel::VISIBLE, nullptr); | 693 ExtensionContextMenuModel::VISIBLE, nullptr); |
| 693 int inspect_popup_index = | 694 int inspect_popup_index = |
| 694 menu.GetIndexOfCommandId(ExtensionContextMenuModel::INSPECT_POPUP); | 695 menu.GetIndexOfCommandId(ExtensionContextMenuModel::INSPECT_POPUP); |
| 695 EXPECT_EQ(-1, inspect_popup_index); | 696 EXPECT_EQ(-1, inspect_popup_index); |
| 696 } | 697 } |
| 697 } | 698 } |
| 698 | 699 |
| 699 } // namespace extensions | 700 } // namespace extensions |
| OLD | NEW |