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

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

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again; base::File changes conflicted. Created 7 years, 10 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 "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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "chrome/browser/extensions/management_policy.h" 49 #include "chrome/browser/extensions/management_policy.h"
50 #include "chrome/browser/extensions/pack_extension_job.h" 50 #include "chrome/browser/extensions/pack_extension_job.h"
51 #include "chrome/browser/extensions/pending_extension_info.h" 51 #include "chrome/browser/extensions/pending_extension_info.h"
52 #include "chrome/browser/extensions/pending_extension_manager.h" 52 #include "chrome/browser/extensions/pending_extension_manager.h"
53 #include "chrome/browser/extensions/test_extension_system.h" 53 #include "chrome/browser/extensions/test_extension_system.h"
54 #include "chrome/browser/extensions/test_management_policy.h" 54 #include "chrome/browser/extensions/test_management_policy.h"
55 #include "chrome/browser/extensions/unpacked_installer.h" 55 #include "chrome/browser/extensions/unpacked_installer.h"
56 #include "chrome/browser/extensions/updater/extension_updater.h" 56 #include "chrome/browser/extensions/updater/extension_updater.h"
57 #include "chrome/browser/plugins/plugin_prefs_factory.h" 57 #include "chrome/browser/plugins/plugin_prefs_factory.h"
58 #include "chrome/browser/prefs/browser_prefs.h" 58 #include "chrome/browser/prefs/browser_prefs.h"
59 #include "chrome/browser/prefs/pref_registry_syncable.h"
59 #include "chrome/browser/prefs/pref_service_mock_builder.h" 60 #include "chrome/browser/prefs/pref_service_mock_builder.h"
61 #include "chrome/browser/prefs/pref_service_syncable.h"
60 #include "chrome/browser/prefs/scoped_user_pref_update.h" 62 #include "chrome/browser/prefs/scoped_user_pref_update.h"
61 #include "chrome/common/chrome_constants.h" 63 #include "chrome/common/chrome_constants.h"
62 #include "chrome/common/chrome_notification_types.h" 64 #include "chrome/common/chrome_notification_types.h"
63 #include "chrome/common/chrome_paths.h" 65 #include "chrome/common/chrome_paths.h"
64 #include "chrome/common/chrome_switches.h" 66 #include "chrome/common/chrome_switches.h"
65 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" 67 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
66 #include "chrome/common/extensions/extension.h" 68 #include "chrome/common/extensions/extension.h"
67 #include "chrome/common/extensions/extension_l10n_util.h" 69 #include "chrome/common/extensions/extension_l10n_util.h"
68 #include "chrome/common/extensions/extension_manifest_constants.h" 70 #include "chrome/common/extensions/extension_manifest_constants.h"
69 #include "chrome/common/extensions/extension_resource.h" 71 #include "chrome/common/extensions/extension_resource.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 void ExtensionServiceTestBase::InitializeExtensionService( 439 void ExtensionServiceTestBase::InitializeExtensionService(
438 const base::FilePath& profile_path, 440 const base::FilePath& profile_path,
439 const base::FilePath& pref_file, 441 const base::FilePath& pref_file,
440 const base::FilePath& extensions_install_dir, 442 const base::FilePath& extensions_install_dir,
441 bool autoupdate_enabled) { 443 bool autoupdate_enabled) {
442 TestingProfile::Builder profile_builder; 444 TestingProfile::Builder profile_builder;
443 // Create a PrefService that only contains user defined preference values. 445 // Create a PrefService that only contains user defined preference values.
444 PrefServiceMockBuilder builder; 446 PrefServiceMockBuilder builder;
445 builder.WithUserFilePrefs( 447 builder.WithUserFilePrefs(
446 pref_file, loop_.message_loop_proxy()); 448 pref_file, loop_.message_loop_proxy());
447 scoped_ptr<PrefServiceSyncable> prefs(builder.CreateSyncable()); 449 scoped_refptr<PrefRegistrySyncable> registry(new PrefRegistrySyncable);
448 Profile::RegisterUserPrefs(prefs.get()); 450 scoped_ptr<PrefServiceSyncable> prefs(builder.CreateSyncable(registry));
449 chrome::RegisterUserPrefs(prefs.get()); 451 Profile::RegisterUserPrefs(registry);
452 chrome::RegisterUserPrefs(prefs.get(), registry);
450 profile_builder.SetPrefService(prefs.Pass()); 453 profile_builder.SetPrefService(prefs.Pass());
451 profile_builder.SetPath(profile_path); 454 profile_builder.SetPath(profile_path);
452 profile_ = profile_builder.Build(); 455 profile_ = profile_builder.Build();
453 456
454 service_ = static_cast<extensions::TestExtensionSystem*>( 457 service_ = static_cast<extensions::TestExtensionSystem*>(
455 ExtensionSystem::Get(profile_.get()))->CreateExtensionService( 458 ExtensionSystem::Get(profile_.get()))->CreateExtensionService(
456 CommandLine::ForCurrentProcess(), 459 CommandLine::ForCurrentProcess(),
457 extensions_install_dir, 460 extensions_install_dir,
458 autoupdate_enabled); 461 autoupdate_enabled);
459 service_->SetFileTaskRunnerForTesting(loop_.message_loop_proxy()); 462 service_->SetFileTaskRunnerForTesting(loop_.message_loop_proxy());
(...skipping 5393 matching lines...) Expand 10 before | Expand all | Expand 10 after
5853 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); 5856 EXPECT_FALSE(extensions::HasExternalInstallError(service_));
5854 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); 5857 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx));
5855 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); 5858 EXPECT_TRUE(service_->IsExtensionEnabled(page_action));
5856 5859
5857 ExtensionPrefs* prefs = service_->extension_prefs(); 5860 ExtensionPrefs* prefs = service_->extension_prefs();
5858 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & 5861 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) &
5859 Extension::DISABLE_SIDELOAD_WIPEOUT); 5862 Extension::DISABLE_SIDELOAD_WIPEOUT);
5860 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & 5863 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) &
5861 Extension::DISABLE_SIDELOAD_WIPEOUT); 5864 Extension::DISABLE_SIDELOAD_WIPEOUT);
5862 } 5865 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs_unittest.cc ('k') | chrome/browser/extensions/extension_web_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698