Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: chrome/browser/extensions/menu_manager_unittest.cc

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for review Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.h" 10 #include "base/message_loop.h"
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 mock_event_router_.reset(new MockEventRouter(profile_)); 482 mock_event_router_.reset(new MockEventRouter(profile_));
483 return mock_event_router_.get(); 483 return mock_event_router_.get();
484 } 484 }
485 485
486 private: 486 private:
487 scoped_ptr<MockEventRouter> mock_event_router_; 487 scoped_ptr<MockEventRouter> mock_event_router_;
488 488
489 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem); 489 DISALLOW_COPY_AND_ASSIGN(MockExtensionSystem);
490 }; 490 };
491 491
492 ProfileKeyedService* BuildMockExtensionSystem(Profile* profile) { 492 ProfileKeyedService* BuildMockExtensionSystem(
493 return new MockExtensionSystem(profile); 493 content::BrowserContext* profile) {
494 return new MockExtensionSystem(static_cast<Profile*>(profile));
494 } 495 }
495 496
496 // Tests the RemoveAll functionality. 497 // Tests the RemoveAll functionality.
497 TEST_F(MenuManagerTest, RemoveAll) { 498 TEST_F(MenuManagerTest, RemoveAll) {
498 // Try removing all items for an extension id that doesn't have any items. 499 // Try removing all items for an extension id that doesn't have any items.
499 manager_.RemoveAllContextItems("CCCC"); 500 manager_.RemoveAllContextItems("CCCC");
500 501
501 // Add 2 top-level and one child item for extension 1. 502 // Add 2 top-level and one child item for extension 1.
502 Extension* extension1 = AddExtension("1111"); 503 Extension* extension1 = AddExtension("1111");
503 MenuItem* item1 = CreateTestItem(extension1); 504 MenuItem* item1 = CreateTestItem(extension1);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size()); 748 EXPECT_EQ(4u, manager_.MenuItems(extension1->id())->size());
748 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); 749 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size());
749 750
750 // Remove all context menu items with incognito true. 751 // Remove all context menu items with incognito true.
751 manager_.RemoveAllIncognitoContextItems(); 752 manager_.RemoveAllIncognitoContextItems();
752 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size()); 753 EXPECT_EQ(2u, manager_.MenuItems(extension1->id())->size());
753 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size()); 754 EXPECT_EQ(1u, manager_.MenuItems(extension2->id())->size());
754 } 755 }
755 756
756 } // namespace extensions 757 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698