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

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

Issue 5441002: Clean up pref change notification handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix extension prefs breakage Created 10 years 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
Index: chrome/browser/extensions/extensions_service_unittest.cc
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index 4188b29cd9d413ca060bd04d4ed1b2cb81978994..c713315293ed9f84a7f957bb2e83089cdc397563 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -35,6 +35,7 @@
#include "chrome/browser/in_process_webkit/webkit_context.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/pref_value_store.h"
+#include "chrome/browser/prefs/scoped_pref_update.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
@@ -2376,9 +2377,9 @@ TEST_F(ExtensionsServiceTest, BlacklistedByPolicyWillNotInstall) {
InitializeEmptyExtensionsService();
ListValue* whitelist =
- profile_->GetPrefs()->GetMutableList("extensions.install.allowlist");
+ profile_->GetPrefs()->GetMutableList(prefs::kExtensionInstallAllowList);
ListValue* blacklist =
- profile_->GetPrefs()->GetMutableList("extensions.install.denylist");
+ profile_->GetPrefs()->GetMutableList(prefs::kExtensionInstallDenyList);
ASSERT_TRUE(whitelist != NULL && blacklist != NULL);
// Blacklist everything.
@@ -2415,18 +2416,17 @@ TEST_F(ExtensionsServiceTest, BlacklistedByPolicyRemovedIfRunning) {
loop_.RunAllPending();
EXPECT_EQ(1u, service_->extensions()->size());
- PrefService* prefs = profile_->GetPrefs();
- ListValue* blacklist =
- prefs->GetMutableList("extensions.install.denylist");
- ASSERT_TRUE(blacklist != NULL);
-
- // Blacklist this extension.
- blacklist->Append(Value::CreateStringValue(good_crx));
- prefs->ScheduleSavePersistentPrefs();
-
- // Programmatically appending to the prefs doesn't seem to notify the
- // observers... :/
- prefs->pref_notifier()->FireObservers("extensions.install.denylist");
+ { // Scope for pref update notification.
+ PrefService* prefs = profile_->GetPrefs();
+ ScopedPrefUpdate pref_update(prefs, prefs::kExtensionInstallDenyList);
+ ListValue* blacklist =
+ prefs->GetMutableList(prefs::kExtensionInstallDenyList);
+ ASSERT_TRUE(blacklist != NULL);
+
+ // Blacklist this extension.
+ blacklist->Append(Value::CreateStringValue(good_crx));
+ prefs->ScheduleSavePersistentPrefs();
+ }
// Extension should not be running now.
loop_.RunAllPending();
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | chrome/browser/policy/managed_prefs_banner_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698