| 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/menu_manager.h" | 5 #include "chrome/browser/extensions/menu_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 event->user_gesture); | 477 event->user_gesture); |
| 478 } | 478 } |
| 479 | 479 |
| 480 private: | 480 private: |
| 481 DISALLOW_COPY_AND_ASSIGN(MockEventRouter); | 481 DISALLOW_COPY_AND_ASSIGN(MockEventRouter); |
| 482 }; | 482 }; |
| 483 | 483 |
| 484 // MockEventRouter factory function | 484 // MockEventRouter factory function |
| 485 std::unique_ptr<KeyedService> MockEventRouterFactoryFunction( | 485 std::unique_ptr<KeyedService> MockEventRouterFactoryFunction( |
| 486 content::BrowserContext* context) { | 486 content::BrowserContext* context) { |
| 487 return base::WrapUnique(new MockEventRouter(static_cast<Profile*>(context))); | 487 return base::MakeUnique<MockEventRouter>(static_cast<Profile*>(context)); |
| 488 } | 488 } |
| 489 | 489 |
| 490 } // namespace | 490 } // namespace |
| 491 | 491 |
| 492 // Tests the RemoveAll functionality. | 492 // Tests the RemoveAll functionality. |
| 493 TEST_F(MenuManagerTest, RemoveAll) { | 493 TEST_F(MenuManagerTest, RemoveAll) { |
| 494 // Try removing all items for an extension id that doesn't have any items. | 494 // Try removing all items for an extension id that doesn't have any items. |
| 495 manager_.RemoveAllContextItems(MenuItem::ExtensionKey("CCCC")); | 495 manager_.RemoveAllContextItems(MenuItem::ExtensionKey("CCCC")); |
| 496 | 496 |
| 497 // Add 2 top-level and one child item for extension 1. | 497 // Add 2 top-level and one child item for extension 1. |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 EXPECT_EQ(4u, manager_.MenuItems(key1)->size()); | 744 EXPECT_EQ(4u, manager_.MenuItems(key1)->size()); |
| 745 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); | 745 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); |
| 746 | 746 |
| 747 // Remove all context menu items with incognito true. | 747 // Remove all context menu items with incognito true. |
| 748 manager_.RemoveAllIncognitoContextItems(); | 748 manager_.RemoveAllIncognitoContextItems(); |
| 749 EXPECT_EQ(2u, manager_.MenuItems(key1)->size()); | 749 EXPECT_EQ(2u, manager_.MenuItems(key1)->size()); |
| 750 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); | 750 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); |
| 751 } | 751 } |
| 752 | 752 |
| 753 } // namespace extensions | 753 } // namespace extensions |
| OLD | NEW |