| 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 "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 Loading... |
| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 void ExtensionServiceTestBase::InitializeExtensionService( | 437 void ExtensionServiceTestBase::InitializeExtensionService( |
| 436 const FilePath& profile_path, | 438 const FilePath& profile_path, |
| 437 const FilePath& pref_file, | 439 const FilePath& pref_file, |
| 438 const FilePath& extensions_install_dir, | 440 const FilePath& extensions_install_dir, |
| 439 bool autoupdate_enabled) { | 441 bool autoupdate_enabled) { |
| 440 TestingProfile::Builder profile_builder; | 442 TestingProfile::Builder profile_builder; |
| 441 // Create a PrefService that only contains user defined preference values. | 443 // Create a PrefService that only contains user defined preference values. |
| 442 PrefServiceMockBuilder builder; | 444 PrefServiceMockBuilder builder; |
| 443 builder.WithUserFilePrefs( | 445 builder.WithUserFilePrefs( |
| 444 pref_file, loop_.message_loop_proxy()); | 446 pref_file, loop_.message_loop_proxy()); |
| 445 scoped_ptr<PrefServiceSyncable> prefs(builder.CreateSyncable()); | 447 scoped_refptr<PrefRegistrySyncable> registry(new PrefRegistrySyncable); |
| 446 Profile::RegisterUserPrefs(prefs.get()); | 448 scoped_ptr<PrefServiceSyncable> prefs(builder.CreateSyncable(registry)); |
| 447 chrome::RegisterUserPrefs(prefs.get()); | 449 Profile::RegisterUserPrefs(registry); |
| 450 chrome::RegisterUserPrefs(prefs.get(), registry); |
| 448 profile_builder.SetPrefService(prefs.Pass()); | 451 profile_builder.SetPrefService(prefs.Pass()); |
| 449 profile_builder.SetPath(profile_path); | 452 profile_builder.SetPath(profile_path); |
| 450 profile_ = profile_builder.Build(); | 453 profile_ = profile_builder.Build(); |
| 451 | 454 |
| 452 service_ = static_cast<extensions::TestExtensionSystem*>( | 455 service_ = static_cast<extensions::TestExtensionSystem*>( |
| 453 ExtensionSystem::Get(profile_.get()))->CreateExtensionService( | 456 ExtensionSystem::Get(profile_.get()))->CreateExtensionService( |
| 454 CommandLine::ForCurrentProcess(), | 457 CommandLine::ForCurrentProcess(), |
| 455 extensions_install_dir, | 458 extensions_install_dir, |
| 456 autoupdate_enabled); | 459 autoupdate_enabled); |
| 457 service_->SetFileTaskRunnerForTesting(loop_.message_loop_proxy()); | 460 service_->SetFileTaskRunnerForTesting(loop_.message_loop_proxy()); |
| (...skipping 5380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5838 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); | 5841 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); |
| 5839 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); | 5842 EXPECT_FALSE(service_->IsExtensionEnabled(good_crx)); |
| 5840 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); | 5843 EXPECT_TRUE(service_->IsExtensionEnabled(page_action)); |
| 5841 | 5844 |
| 5842 ExtensionPrefs* prefs = service_->extension_prefs(); | 5845 ExtensionPrefs* prefs = service_->extension_prefs(); |
| 5843 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & | 5846 EXPECT_NE(0, prefs->GetDisableReasons(good_crx) & |
| 5844 Extension::DISABLE_SIDELOAD_WIPEOUT); | 5847 Extension::DISABLE_SIDELOAD_WIPEOUT); |
| 5845 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & | 5848 EXPECT_EQ(0, prefs->GetDisableReasons(page_action) & |
| 5846 Extension::DISABLE_SIDELOAD_WIPEOUT); | 5849 Extension::DISABLE_SIDELOAD_WIPEOUT); |
| 5847 } | 5850 } |
| OLD | NEW |