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

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..3c61ca876f0fe7c716f5396eaed830909242d6db 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(std::string(kTypeNames[i]),
kkania 2011/04/12 16:42:42 remove std::string
markusheintz_ 2011/04/12 17:21:49 Done.
+ kDefaultSettings[i]);
+ }
+ }
+}
+
} // namespace
namespace content_settings {
@@ -284,7 +295,20 @@ void PrefDefaultProvider::MigrateObsoleteNotificationPref(PrefService* prefs) {
// static
void PrefDefaultProvider::RegisterUserPrefs(PrefService* prefs) {
- prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings);
+ // If no default values are set explicitely for the
+ // prefs::kDefaultContentSettings preference an empty dictionary will be used
+ // as default value instead. This has some issues. For example pyauto tests
+ // can't get the default values for content settings as the default value of
+ // the preference prefs::kDefaultContentSettings is an empty dictionary. To
+ // prevent that functional tests need to know the default content settings
+ // expliciatly we set them here.
kkania 2011/04/12 16:42:42 this comment is a bit wordy yet confusing; part of
markusheintz_ 2011/04/12 17:21:49 Done.
+ // TODO(markusheintz): Write pyauto hooks for the content settings map, as the
+ // content settings map should be used as exclusive source for content
+ // settings.
+ 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