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

Unified Diff: chrome/browser/profile_resetter/profile_resetter_unittest.cc

Issue 376253005: Migrate the notification permission to the new common permission classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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
Index: chrome/browser/profile_resetter/profile_resetter_unittest.cc
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
index 8b483947a8e783a0553951e5004d76960c3e4a5e..9db4dd6406424c0fda22620d19dc3c74ce40260a 100644
--- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc
+++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
@@ -12,8 +12,6 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/tab_helper.h"
-#include "chrome/browser/notifications/desktop_notification_service.h"
-#include "chrome/browser/notifications/desktop_notification_service_factory.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
#include "chrome/browser/profile_resetter/profile_resetter_test_base.h"
@@ -494,19 +492,14 @@ TEST_F(ProfileResetterTest, ResetHomepagePartially) {
TEST_F(ProfileResetterTest, ResetContentSettings) {
HostContentSettingsMap* host_content_settings_map =
profile()->GetHostContentSettingsMap();
- DesktopNotificationService* notification_service =
- DesktopNotificationServiceFactory::GetForProfile(profile());
ContentSettingsPattern pattern =
ContentSettingsPattern::FromString("[*.]example.org");
std::map<ContentSettingsType, ContentSetting> default_settings;
for (int type = 0; type < CONTENT_SETTINGS_NUM_TYPES; ++type) {
- if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
- notification_service->SetDefaultContentSetting(CONTENT_SETTING_BLOCK);
- notification_service->GrantPermission(GURL("http://foo.de"));
- } else if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE ||
- type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT ||
- type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) {
+ if (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE ||
+ type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT ||
+ type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS) {
// These types are excluded because one can't call
// GetDefaultContentSetting() for them.
} else {
@@ -551,38 +544,31 @@ TEST_F(ProfileResetterTest, ResetContentSettings) {
ResetAndWait(ProfileResetter::CONTENT_SETTINGS);
for (int type = 0; type < CONTENT_SETTINGS_NUM_TYPES; ++type) {
- if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
- EXPECT_EQ(CONTENT_SETTING_ASK,
- notification_service->GetDefaultContentSetting(NULL));
- EXPECT_EQ(CONTENT_SETTING_ASK,
- notification_service->GetContentSetting(GURL("http://foo.de")));
- } else {
- ContentSettingsType content_type = static_cast<ContentSettingsType>(type);
- if (HostContentSettingsMap::ContentTypeHasCompoundValue(content_type) ||
- type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE ||
- content_type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT ||
- content_type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS)
- continue;
- ContentSetting default_setting =
- host_content_settings_map->GetDefaultContentSetting(content_type,
+ ContentSettingsType content_type = static_cast<ContentSettingsType>(type);
+ if (HostContentSettingsMap::ContentTypeHasCompoundValue(content_type) ||
+ type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE ||
+ content_type == CONTENT_SETTINGS_TYPE_MIXEDSCRIPT ||
+ content_type == CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS)
+ continue;
+ ContentSetting default_setting =
+ host_content_settings_map->GetDefaultContentSetting(content_type,
NULL);
- EXPECT_TRUE(default_settings.count(content_type));
- EXPECT_EQ(default_settings[content_type], default_setting);
- if (!HostContentSettingsMap::ContentTypeHasCompoundValue(content_type)) {
- ContentSetting site_setting =
- host_content_settings_map->GetContentSetting(
- GURL("example.org"),
- GURL(),
- content_type,
- std::string());
- EXPECT_EQ(default_setting, site_setting);
- }
-
- ContentSettingsForOneType host_settings;
- host_content_settings_map->GetSettingsForOneType(
- content_type, std::string(), &host_settings);
- EXPECT_EQ(1U, host_settings.size());
+ EXPECT_TRUE(default_settings.count(content_type));
+ EXPECT_EQ(default_settings[content_type], default_setting);
+ if (!HostContentSettingsMap::ContentTypeHasCompoundValue(content_type)) {
+ ContentSetting site_setting =
+ host_content_settings_map->GetContentSetting(
+ GURL("example.org"),
+ GURL(),
+ content_type,
+ std::string());
+ EXPECT_EQ(default_setting, site_setting);
}
+
+ ContentSettingsForOneType host_settings;
+ host_content_settings_map->GetSettingsForOneType(
+ content_type, std::string(), &host_settings);
+ EXPECT_EQ(1U, host_settings.size());
}
}
« no previous file with comments | « chrome/browser/notifications/notification_browsertest.cc ('k') | chrome/browser/ui/webui/options/content_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698