Index: chrome/browser/extensions/extension_service_unittest.cc |
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc |
index e7063182042f9b238061875e1ac07dcff6012a06..ce6f3e855ef547c7f3ff4435a17fe068aa6b0850 100644 |
--- a/chrome/browser/extensions/extension_service_unittest.cc |
+++ b/chrome/browser/extensions/extension_service_unittest.cc |
@@ -603,7 +603,7 @@ void ExtensionServiceTestBase::InitializeExtensionServiceWithUpdater() { |
void ExtensionServiceTestBase::InitializeExtensionSyncService() { |
extension_sync_service_.reset(new ExtensionSyncService( |
- profile_.get(), service_->extension_prefs(), service_)); |
+ profile_.get(), ExtensionPrefs::Get(profile_.get()), service_)); |
} |
// static |
@@ -1568,7 +1568,7 @@ TEST_F(ExtensionServiceTest, UpdateOnStartup) { |
"hpiknbiabeeppbpihjehijgoemciehgk/3"))); |
// Make sure update information got deleted. |
- ExtensionPrefs* prefs = service_->extension_prefs(); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get()); |
EXPECT_FALSE( |
prefs->GetDelayedInstallInfo("bjafgdebaacbbbecmhlhpofkepfkgcpa")); |
} |
@@ -1602,7 +1602,7 @@ TEST_F(ExtensionServiceTest, PendingImports) { |
// Each of these extensions should have been rejected because of dependencies |
// that cannot be satisfied. |
- ExtensionPrefs* prefs = service_->extension_prefs(); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get()); |
EXPECT_FALSE( |
prefs->GetDelayedInstallInfo("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")); |
EXPECT_FALSE( |
@@ -2020,7 +2020,7 @@ TEST_F(ExtensionServiceTest, GrantedPermissions) { |
ASSERT_TRUE(base::PathExists(pem_path)); |
ASSERT_TRUE(base::PathExists(path)); |
- ExtensionPrefs* prefs = service_->extension_prefs(); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get()); |
APIPermissionSet expected_api_perms; |
URLPatternSet expected_host_perms; |
@@ -2068,7 +2068,7 @@ TEST_F(ExtensionServiceTest, DefaultAppsGrantedPermissions) { |
ASSERT_TRUE(base::PathExists(pem_path)); |
ASSERT_TRUE(base::PathExists(path)); |
- ExtensionPrefs* prefs = service_->extension_prefs(); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get()); |
APIPermissionSet expected_api_perms; |
URLPatternSet expected_host_perms; |
@@ -2110,7 +2110,7 @@ TEST_F(ExtensionServiceTest, GrantedFullAccessPermissions) { |
const Extension* extension = PackAndInstallCRX(good1_path(), INSTALL_NEW); |
EXPECT_EQ(0u, GetErrors().size()); |
EXPECT_EQ(1u, service_->extensions()->size()); |
- ExtensionPrefs* prefs = service_->extension_prefs(); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get()); |
scoped_refptr<PermissionSet> permissions( |
prefs->GetGrantedPermissions(extension->id())); |
@@ -2142,7 +2142,7 @@ TEST_F(ExtensionServiceTest, GrantedAPIAndHostPermissions) { |
EXPECT_EQ(1u, service_->extensions()->size()); |
std::string extension_id = extension->id(); |
- ExtensionPrefs* prefs = service_->extension_prefs(); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get()); |
APIPermissionSet expected_api_permissions; |
URLPatternSet expected_host_permissions; |
@@ -2638,7 +2638,8 @@ TEST_F(ExtensionServiceTest, DefaultFileAccess) { |
INSTALL_NEW); |
EXPECT_EQ(0u, GetErrors().size()); |
EXPECT_EQ(1u, service_->extensions()->size()); |
- EXPECT_FALSE(service_->extension_prefs()->AllowFileAccess(extension->id())); |
+ EXPECT_FALSE( |
+ ExtensionPrefs::Get(profile_.get())->AllowFileAccess(extension->id())); |
} |
TEST_F(ExtensionServiceTest, UpdateApps) { |
@@ -2663,7 +2664,7 @@ TEST_F(ExtensionServiceTest, UpdateApps) { |
// Verifies that the NTP page and launch ordinals are kept when updating apps. |
TEST_F(ExtensionServiceTest, UpdateAppsRetainOrdinals) { |
InitializeEmptyExtensionService(); |
- AppSorting* sorting = service_->extension_prefs()->app_sorting(); |
+ AppSorting* sorting = ExtensionPrefs::Get(profile_.get())->app_sorting(); |
base::FilePath extensions_path = data_dir_.AppendASCII("app_update"); |
// First install v1 of a hosted app. |
@@ -2699,7 +2700,7 @@ TEST_F(ExtensionServiceTest, EnsureCWSOrdinalsInitialized) { |
IDR_WEBSTORE_MANIFEST, base::FilePath(FILE_PATH_LITERAL("web_store"))); |
service_->Init(); |
- AppSorting* sorting = service_->extension_prefs()->app_sorting(); |
+ AppSorting* sorting = ExtensionPrefs::Get(profile_.get())->app_sorting(); |
EXPECT_TRUE( |
sorting->GetPageOrdinal(extension_misc::kWebStoreAppId).IsValid()); |
EXPECT_TRUE( |
@@ -2979,7 +2980,8 @@ TEST_F(ExtensionServiceTest, UpdateExtensionPreservesState) { |
// over to the updated version. |
service_->DisableExtension(good->id(), Extension::DISABLE_USER_ACTION); |
extensions::util::SetIsIncognitoEnabled(good->id(), profile_.get(), true); |
- service_->extension_prefs()->SetDidExtensionEscalatePermissions(good, true); |
+ ExtensionPrefs::Get(profile_.get())-> |
+ SetDidExtensionEscalatePermissions(good, true); |
path = data_dir_.AppendASCII("good2.crx"); |
UpdateExtension(good_crx, path, INSTALLED); |
@@ -2988,8 +2990,8 @@ TEST_F(ExtensionServiceTest, UpdateExtensionPreservesState) { |
ASSERT_EQ("1.0.0.1", good2->version()->GetString()); |
EXPECT_TRUE(extensions::util::IsIncognitoEnabled( |
good2->id(), profile_.get())); |
- EXPECT_TRUE(service_->extension_prefs()->DidExtensionEscalatePermissions( |
- good2->id())); |
+ EXPECT_TRUE(ExtensionPrefs::Get(profile_.get())-> |
+ DidExtensionEscalatePermissions(good2->id())); |
} |
// Tests that updating preserves extension location. |
@@ -3112,7 +3114,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) { |
// Make sure the granted permissions have been setup. |
scoped_refptr<PermissionSet> permissions( |
- service_->extension_prefs()->GetGrantedPermissions(good1)); |
+ ExtensionPrefs::Get(profile_.get())->GetGrantedPermissions(good1)); |
EXPECT_FALSE(permissions->IsEmpty()); |
EXPECT_TRUE(permissions->HasEffectiveFullAccess()); |
EXPECT_FALSE(permissions->apis().empty()); |
@@ -3208,8 +3210,8 @@ TEST_F(ExtensionServiceTest, DISABLED_UpdatePendingTheme) { |
const Extension* extension = service_->GetExtensionById(theme_crx, true); |
ASSERT_TRUE(extension); |
- EXPECT_FALSE( |
- service_->extension_prefs()->IsExtensionDisabled(extension->id())); |
+ EXPECT_FALSE(ExtensionPrefs::Get(profile_.get())-> |
+ IsExtensionDisabled(extension->id())); |
EXPECT_TRUE(service_->IsExtensionEnabled(theme_crx)); |
} |
@@ -3238,8 +3240,8 @@ TEST_F(ExtensionServiceTest, MAYBE_UpdatePendingExternalCrx) { |
const Extension* extension = service_->GetExtensionById(theme_crx, true); |
ASSERT_TRUE(extension); |
- EXPECT_FALSE( |
- service_->extension_prefs()->IsExtensionDisabled(extension->id())); |
+ EXPECT_FALSE(ExtensionPrefs::Get(profile_.get())-> |
+ IsExtensionDisabled(extension->id())); |
EXPECT_TRUE(service_->IsExtensionEnabled(extension->id())); |
EXPECT_FALSE(extensions::util::IsIncognitoEnabled(extension->id(), |
profile_.get())); |
@@ -3474,7 +3476,7 @@ TEST_F(ExtensionServiceTest, UnloadBlacklistedExtensionPolicy) { |
EXPECT_EQ(1u, service_->extensions()->size()); |
base::ListValue whitelist; |
- PrefService* prefs = service_->extension_prefs()->pref_service(); |
+ PrefService* prefs = ExtensionPrefs::Get(profile_.get())->pref_service(); |
whitelist.Append(new base::StringValue(good_crx)); |
prefs->Set(extensions::pref_names::kInstallAllowList, whitelist); |
@@ -3526,8 +3528,8 @@ TEST_F(ExtensionServiceTest, BlacklistedInPrefsFromStartup) { |
InitializeGoodInstalledExtensionService(); |
test_blacklist.Attach(service_->blacklist_); |
- service_->extension_prefs()->SetExtensionBlacklisted(good0, true); |
- service_->extension_prefs()->SetExtensionBlacklisted(good1, true); |
+ ExtensionPrefs::Get(profile_.get())->SetExtensionBlacklisted(good0, true); |
+ ExtensionPrefs::Get(profile_.get())->SetExtensionBlacklisted(good1, true); |
test_blacklist.SetBlacklistState( |
good1, extensions::BLACKLISTED_MALWARE, false); |
@@ -4056,7 +4058,7 @@ TEST_F(ExtensionServiceTest, MAYBE_ExternalExtensionAutoAcknowledgement) { |
ASSERT_EQ(2u, service_->extensions()->size()); |
EXPECT_TRUE(service_->GetExtensionById(good_crx, false)); |
EXPECT_TRUE(service_->GetExtensionById(page_action, false)); |
- ExtensionPrefs* prefs = service_->extension_prefs(); |
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get()); |
ASSERT_TRUE(!prefs->IsExternalExtensionAcknowledged(good_crx)); |
ASSERT_TRUE(prefs->IsExternalExtensionAcknowledged(page_action)); |
} |
@@ -4265,8 +4267,8 @@ TEST_F(ExtensionServiceTest, ReloadExtension) { |
// Extension should be disabled now, waiting to be reloaded. |
EXPECT_EQ(0u, service_->extensions()->size()); |
EXPECT_EQ(1u, service_->disabled_extensions()->size()); |
- EXPECT_EQ(Extension::DISABLE_RELOAD, |
- service_->extension_prefs()->GetDisableReasons(extension_id)); |
+ EXPECT_EQ(Extension::DISABLE_RELOAD, ExtensionPrefs::Get(profile_.get())-> |
+ GetDisableReasons(extension_id)); |
// Reloading again should not crash. |
service_->ReloadExtension(extension_id); |
@@ -5820,7 +5822,7 @@ TEST_F(ExtensionServiceTest, GetSyncAppDataUserSettings) { |
EXPECT_TRUE(initial_ordinal.Equals(app_sync_data.page_ordinal())); |
} |
- AppSorting* sorting = service_->extension_prefs()->app_sorting(); |
+ AppSorting* sorting = ExtensionPrefs::Get(profile_.get())->app_sorting(); |
sorting->SetAppLaunchOrdinal(app->id(), initial_ordinal.CreateAfter()); |
{ |
syncer::SyncDataList list = extension_sync_service_->GetAllSyncData( |
@@ -6909,9 +6911,9 @@ TEST_F(ExtensionServiceTest, InstallBlacklistedExtension) { |
EXPECT_FALSE(registry->enabled_extensions().Contains(id)); |
EXPECT_TRUE(registry->blacklisted_extensions().Contains(id)); |
- EXPECT_TRUE(service_->extension_prefs()->IsExtensionBlacklisted(id)); |
- EXPECT_TRUE( |
- service_->extension_prefs()->IsBlacklistedExtensionAcknowledged(id)); |
+ EXPECT_TRUE(ExtensionPrefs::Get(profile_.get())->IsExtensionBlacklisted(id)); |
+ EXPECT_TRUE(ExtensionPrefs::Get(profile_.get())-> |
+ IsBlacklistedExtensionAcknowledged(id)); |
} |
TEST_F(ExtensionServiceTest, ReconcileKnownDisabledNoneDisabled) { |
@@ -6938,7 +6940,7 @@ TEST_F(ExtensionServiceTest, ReconcileKnownDisabledWithSideEnable) { |
// A profile with 3 extensions installed: good0, good1, and good2. |
InitializeGoodInstalledExtensionService(); |
- ExtensionPrefs* extension_prefs = service_->extension_prefs(); |
+ ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile_.get()); |
// Disable good1. |
extension_prefs->SetExtensionState(good1, Extension::DISABLED); |