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

Unified Diff: chrome/browser/content_settings/content_settings_pref_provider.cc

Issue 6823076: Fix functional tests notifications.NotificationsTest(s) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 8 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 | « no previous file | chrome/test/functional/notifications.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/content_settings/content_settings_pref_provider.cc
diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc
index 7c09a6b82414b120b7ab1d5a762ac7c063aa5c4b..e73ed1844d80bd7a3af73bc33aa5498decab85c1 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider.cc
+++ b/chrome/browser/content_settings/content_settings_pref_provider.cc
@@ -49,7 +49,7 @@ const ContentSetting kDefaultSettings[] = {
CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS
CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS
CONTENT_SETTING_ASK, // Not used for Geolocation
- CONTENT_SETTING_ASK, // Not used for Notifications
+ CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS
CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PRERENDER
};
COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES,
@@ -71,6 +71,17 @@ const char* kTypeNames[] = {
COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES,
type_names_incorrect_size);
+void SetDefaultContentSettings(DictionaryValue* default_settings) {
+ default_settings->Clear();
+
+ for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
+ if (kTypeNames[i] != NULL) {
+ default_settings->SetInteger(kTypeNames[i],
+ kDefaultSettings[i]);
+ }
+ }
+}
+
} // namespace
namespace content_settings {
@@ -284,7 +295,16 @@ void PrefDefaultProvider::MigrateObsoleteNotificationPref(PrefService* prefs) {
// static
void PrefDefaultProvider::RegisterUserPrefs(PrefService* prefs) {
- prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings);
+ // The registration of the preference prefs::kDefaultContentSettings should
+ // also include the default values for default content settings. This allows
+ // functional tests to get default content settings by reading the preference
+ // prefs::kDefaultContentSettings via pyauto.
+ // TODO(markusheintz): Write pyauto hooks for the content settings map as
+ // content settings should be read from the host content settings map.
+ DictionaryValue* default_content_settings = new DictionaryValue();
+ SetDefaultContentSettings(default_content_settings);
+ prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings,
+ default_content_settings);
// Obsolete prefs, for migrations:
prefs->RegisterIntegerPref(
« no previous file with comments | « no previous file | chrome/test/functional/notifications.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698