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

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

Issue 64193003: Clean up PrefServiceBuilder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory ownership bug in ProxyPolicyTest Created 7 years, 1 month 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "chrome/browser/extensions/installed_loader.h" 58 #include "chrome/browser/extensions/installed_loader.h"
59 #include "chrome/browser/extensions/management_policy.h" 59 #include "chrome/browser/extensions/management_policy.h"
60 #include "chrome/browser/extensions/pack_extension_job.h" 60 #include "chrome/browser/extensions/pack_extension_job.h"
61 #include "chrome/browser/extensions/pending_extension_info.h" 61 #include "chrome/browser/extensions/pending_extension_info.h"
62 #include "chrome/browser/extensions/pending_extension_manager.h" 62 #include "chrome/browser/extensions/pending_extension_manager.h"
63 #include "chrome/browser/extensions/test_extension_system.h" 63 #include "chrome/browser/extensions/test_extension_system.h"
64 #include "chrome/browser/extensions/test_management_policy.h" 64 #include "chrome/browser/extensions/test_management_policy.h"
65 #include "chrome/browser/extensions/unpacked_installer.h" 65 #include "chrome/browser/extensions/unpacked_installer.h"
66 #include "chrome/browser/extensions/updater/extension_updater.h" 66 #include "chrome/browser/extensions/updater/extension_updater.h"
67 #include "chrome/browser/prefs/browser_prefs.h" 67 #include "chrome/browser/prefs/browser_prefs.h"
68 #include "chrome/browser/prefs/pref_service_mock_builder.h" 68 #include "chrome/browser/prefs/pref_service_mock_factory.h"
69 #include "chrome/browser/prefs/pref_service_syncable.h" 69 #include "chrome/browser/prefs/pref_service_syncable.h"
70 #include "chrome/browser/sync/profile_sync_service.h" 70 #include "chrome/browser/sync/profile_sync_service.h"
71 #include "chrome/browser/sync/profile_sync_service_factory.h" 71 #include "chrome/browser/sync/profile_sync_service_factory.h"
72 #include "chrome/common/chrome_constants.h" 72 #include "chrome/common/chrome_constants.h"
73 #include "chrome/common/chrome_paths.h" 73 #include "chrome/common/chrome_paths.h"
74 #include "chrome/common/chrome_switches.h" 74 #include "chrome/common/chrome_switches.h"
75 #include "chrome/common/extensions/api/plugins/plugins_handler.h" 75 #include "chrome/common/extensions/api/plugins/plugins_handler.h"
76 #include "chrome/common/extensions/extension_l10n_util.h" 76 #include "chrome/common/extensions/extension_l10n_util.h"
77 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 77 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
78 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" 78 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 473 }
474 474
475 ExtensionServiceTestBase::~ExtensionServiceTestBase() { 475 ExtensionServiceTestBase::~ExtensionServiceTestBase() {
476 service_ = NULL; 476 service_ = NULL;
477 } 477 }
478 478
479 void ExtensionServiceTestBase::InitializeExtensionService( 479 void ExtensionServiceTestBase::InitializeExtensionService(
480 const ExtensionServiceTestBase::ExtensionServiceInitParams& params) { 480 const ExtensionServiceTestBase::ExtensionServiceInitParams& params) {
481 TestingProfile::Builder profile_builder; 481 TestingProfile::Builder profile_builder;
482 // Create a PrefService that only contains user defined preference values. 482 // Create a PrefService that only contains user defined preference values.
483 PrefServiceMockBuilder builder; 483 PrefServiceMockFactory factory;
484 // If pref_file is empty, TestingProfile automatically creates 484 // If pref_file is empty, TestingProfile automatically creates
485 // TestingPrefServiceSyncable instance. 485 // TestingPrefServiceSyncable instance.
486 if (!params.pref_file.empty()) { 486 if (!params.pref_file.empty()) {
487 builder.WithUserFilePrefs(params.pref_file, 487 factory.SetUserPrefsFile(params.pref_file,
488 base::MessageLoopProxy::current().get()); 488 base::MessageLoopProxy::current().get());
489 scoped_refptr<user_prefs::PrefRegistrySyncable> registry( 489 scoped_refptr<user_prefs::PrefRegistrySyncable> registry(
490 new user_prefs::PrefRegistrySyncable); 490 new user_prefs::PrefRegistrySyncable);
491 scoped_ptr<PrefServiceSyncable> prefs( 491 scoped_ptr<PrefServiceSyncable> prefs(
492 builder.CreateSyncable(registry.get())); 492 factory.CreateSyncable(registry.get()));
493 chrome::RegisterUserProfilePrefs(registry.get()); 493 chrome::RegisterUserProfilePrefs(registry.get());
494 profile_builder.SetPrefService(prefs.Pass()); 494 profile_builder.SetPrefService(prefs.Pass());
495 } 495 }
496 496
497 if (params.profile_is_managed) 497 if (params.profile_is_managed)
498 profile_builder.SetManagedUserId("asdf"); 498 profile_builder.SetManagedUserId("asdf");
499 499
500 profile_builder.SetPath(params.profile_path); 500 profile_builder.SetPath(params.profile_path);
501 profile_ = profile_builder.Build(); 501 profile_ = profile_builder.Build();
502 502
(...skipping 6236 matching lines...) Expand 10 before | Expand all | Expand 10 after
6739 service_->ReconcileKnownDisabled(); 6739 service_->ReconcileKnownDisabled();
6740 expected_extensions.insert(good2); 6740 expected_extensions.insert(good2);
6741 expected_disabled_extensions.erase(good2); 6741 expected_disabled_extensions.erase(good2);
6742 6742
6743 EXPECT_EQ(expected_extensions, service_->extensions()->GetIDs()); 6743 EXPECT_EQ(expected_extensions, service_->extensions()->GetIDs());
6744 EXPECT_EQ(expected_disabled_extensions, 6744 EXPECT_EQ(expected_disabled_extensions,
6745 service_->disabled_extensions()->GetIDs()); 6745 service_->disabled_extensions()->GetIDs());
6746 } 6746 }
6747 6747
6748 #endif // #if !(defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS)) 6748 #endif // #if !(defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698