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

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

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 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
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_ptr.h"
9 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
11 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/browser/chrome_notification_types.h" 15 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/extensions/extension_system_factory.h" 16 #include "chrome/browser/extensions/extension_system_factory.h"
16 #include "chrome/browser/extensions/menu_manager.h" 17 #include "chrome/browser/extensions/menu_manager.h"
17 #include "chrome/browser/extensions/test_extension_prefs.h" 18 #include "chrome/browser/extensions/test_extension_prefs.h"
18 #include "chrome/browser/extensions/test_extension_system.h" 19 #include "chrome/browser/extensions/test_extension_system.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 event->restrict_to_browser_context, 477 event->restrict_to_browser_context,
477 event->event_url, 478 event->event_url,
478 event->user_gesture); 479 event->user_gesture);
479 } 480 }
480 481
481 private: 482 private:
482 DISALLOW_COPY_AND_ASSIGN(MockEventRouter); 483 DISALLOW_COPY_AND_ASSIGN(MockEventRouter);
483 }; 484 };
484 485
485 // MockEventRouter factory function 486 // MockEventRouter factory function
486 KeyedService* MockEventRouterFactoryFunction(content::BrowserContext* profile) { 487 scoped_ptr<KeyedService> MockEventRouterFactoryFunction(
487 return new MockEventRouter(static_cast<Profile*>(profile)); 488 content::BrowserContext* profile) {
Devlin 2015/06/08 19:29:43 nit: rename
Ilya Sherman 2015/06/08 22:11:43 Done.
489 return make_scoped_ptr(new MockEventRouter(static_cast<Profile*>(profile)));
488 } 490 }
489 491
490 } // namespace 492 } // namespace
491 493
492 // Tests the RemoveAll functionality. 494 // Tests the RemoveAll functionality.
493 TEST_F(MenuManagerTest, RemoveAll) { 495 TEST_F(MenuManagerTest, RemoveAll) {
494 // Try removing all items for an extension id that doesn't have any items. 496 // Try removing all items for an extension id that doesn't have any items.
495 manager_.RemoveAllContextItems(MenuItem::ExtensionKey("CCCC")); 497 manager_.RemoveAllContextItems(MenuItem::ExtensionKey("CCCC"));
496 498
497 // Add 2 top-level and one child item for extension 1. 499 // Add 2 top-level and one child item for extension 1.
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 EXPECT_EQ(4u, manager_.MenuItems(key1)->size()); 745 EXPECT_EQ(4u, manager_.MenuItems(key1)->size());
744 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); 746 EXPECT_EQ(1u, manager_.MenuItems(key2)->size());
745 747
746 // Remove all context menu items with incognito true. 748 // Remove all context menu items with incognito true.
747 manager_.RemoveAllIncognitoContextItems(); 749 manager_.RemoveAllIncognitoContextItems();
748 EXPECT_EQ(2u, manager_.MenuItems(key1)->size()); 750 EXPECT_EQ(2u, manager_.MenuItems(key1)->size());
749 EXPECT_EQ(1u, manager_.MenuItems(key2)->size()); 751 EXPECT_EQ(1u, manager_.MenuItems(key2)->size());
750 } 752 }
751 753
752 } // namespace extensions 754 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698