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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 mock_event_router_.reset(new MockEventRouter(profile_)); | 491 mock_event_router_.reset(new MockEventRouter(profile_)); |
492 return mock_event_router_.get(); | 492 return mock_event_router_.get(); |
493 } | 493 } |
494 | 494 |
495 private: | 495 private: |
496 scoped_ptr<MockEventRouter> mock_event_router_; | 496 scoped_ptr<MockEventRouter> mock_event_router_; |
497 | 497 |
498 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem); | 498 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem); |
499 }; | 499 }; |
500 | 500 |
501 BrowserContextKeyedService* BuildMockExtensionSystem( | 501 KeyedService* BuildMockExtensionSystem(content::BrowserContext* profile) { |
502 content::BrowserContext* profile) { | |
503 return new MockExtensionSystem(static_cast<Profile*>(profile)); | 502 return new MockExtensionSystem(static_cast<Profile*>(profile)); |
504 } | 503 } |
505 | 504 |
506 // Tests the RemoveAll functionality. | 505 // Tests the RemoveAll functionality. |
507 TEST_F(MenuManagerTest, RemoveAll) { | 506 TEST_F(MenuManagerTest, RemoveAll) { |
508 // Try removing all items for an extension id that doesn't have any items. | 507 // Try removing all items for an extension id that doesn't have any items. |
509 manager_.RemoveAllContextItems(MenuItem::ExtensionKey("CCCC")); | 508 manager_.RemoveAllContextItems(MenuItem::ExtensionKey("CCCC")); |
510 | 509 |
511 // Add 2 top-level and one child item for extension 1. | 510 // Add 2 top-level and one child item for extension 1. |
512 Extension* extension1 = AddExtension("1111"); | 511 Extension* extension1 = AddExtension("1111"); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 EXPECT_EQ(4u, manager_.MenuItems(key1)->size()); | 760 EXPECT_EQ(4u, manager_.MenuItems(key1)->size()); |
762 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); | 761 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); |
763 | 762 |
764 // Remove all context menu items with incognito true. | 763 // Remove all context menu items with incognito true. |
765 manager_.RemoveAllIncognitoContextItems(); | 764 manager_.RemoveAllIncognitoContextItems(); |
766 EXPECT_EQ(2u, manager_.MenuItems(key1)->size()); | 765 EXPECT_EQ(2u, manager_.MenuItems(key1)->size()); |
767 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); | 766 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); |
768 } | 767 } |
769 | 768 |
770 } // namespace extensions | 769 } // namespace extensions |
OLD | NEW |