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

Unified Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 156843004: Remove ExtensionService::extension_prefs() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix UserScriptListenerTests.MultiProfile Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 317c7f3c49da32fb013697cb6e9a207a5652fd60..0f215348614b9bd0724218861131847a9919ac08 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -604,7 +604,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
@@ -1565,7 +1565,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"));
}
@@ -1598,7 +1598,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(
@@ -2016,7 +2016,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;
@@ -2064,7 +2064,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;
@@ -2106,7 +2106,7 @@ TEST_F(ExtensionServiceTest, GrantedFullAccessPermissions) {
const Extension* extension = PackAndInstallCRX(good1_path(), INSTALL_NEW);
EXPECT_EQ(0u, GetErrors().size());
EXPECT_EQ(1u, registry_->enabled_extensions().size());
- ExtensionPrefs* prefs = service_->extension_prefs();
+ ExtensionPrefs* prefs = ExtensionPrefs::Get(profile_.get());
scoped_refptr<PermissionSet> permissions(
prefs->GetGrantedPermissions(extension->id()));
@@ -2138,7 +2138,7 @@ TEST_F(ExtensionServiceTest, GrantedAPIAndHostPermissions) {
EXPECT_EQ(1u, registry_->enabled_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;
@@ -2634,7 +2634,8 @@ TEST_F(ExtensionServiceTest, DefaultFileAccess) {
INSTALL_NEW);
EXPECT_EQ(0u, GetErrors().size());
EXPECT_EQ(1u, registry_->enabled_extensions().size());
- EXPECT_FALSE(service_->extension_prefs()->AllowFileAccess(extension->id()));
+ EXPECT_FALSE(
+ ExtensionPrefs::Get(profile_.get())->AllowFileAccess(extension->id()));
}
TEST_F(ExtensionServiceTest, UpdateApps) {
@@ -2659,7 +2660,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.
@@ -2695,7 +2696,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(
@@ -2975,7 +2976,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);
@@ -2984,8 +2986,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.
@@ -3108,7 +3110,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());
@@ -3204,8 +3206,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));
}
@@ -3234,8 +3236,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()));
@@ -3469,7 +3471,7 @@ TEST_F(ExtensionServiceTest, UnloadBlacklistedExtensionPolicy) {
EXPECT_EQ(1u, registry_->enabled_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);
@@ -3520,8 +3522,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);
@@ -4046,7 +4048,7 @@ TEST_F(ExtensionServiceTest, MAYBE_ExternalExtensionAutoAcknowledgement) {
ASSERT_EQ(2u, registry_->enabled_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));
}
@@ -4252,8 +4254,9 @@ TEST_F(ExtensionServiceTest, ReloadExtension) {
// Extension should be disabled now, waiting to be reloaded.
EXPECT_EQ(0u, registry_->enabled_extensions().size());
EXPECT_EQ(1u, registry_->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);
@@ -5806,7 +5809,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(
@@ -6894,9 +6897,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) {
@@ -6923,7 +6926,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);
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/extension_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698