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

Unified Diff: chrome/browser/notifications/message_center_settings_controller_unittest.cc

Issue 2713083003: Use ContentSetting in chrome/ instead of PermissionStatus (Closed)
Patch Set: maybe fix android compile + address comments + basic tests Created 3 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
Index: chrome/browser/notifications/message_center_settings_controller_unittest.cc
diff --git a/chrome/browser/notifications/message_center_settings_controller_unittest.cc b/chrome/browser/notifications/message_center_settings_controller_unittest.cc
index 5f663a0982bc47d6592441d32429626784de3435..4326ff8a86596b08c3273b883f1ce92fd7ee321f 100644
--- a/chrome/browser/notifications/message_center_settings_controller_unittest.cc
+++ b/chrome/browser/notifications/message_center_settings_controller_unittest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/notifications/message_center_settings_controller.h"
#include "chrome/browser/permissions/permission_manager.h"
+#include "chrome/browser/permissions/permission_result.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_profile_manager.h"
@@ -315,15 +316,19 @@ TEST_F(MessageCenterSettingsControllerTest, SetWebPageNotifierEnabled) {
// (1) Enable the permission when the default is to ask (expected to set).
controller()->SetNotifierEnabled(disabled_notifier, true);
- EXPECT_EQ(blink::mojom::PermissionStatus::GRANTED,
- permission_manager->GetPermissionStatus(
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin));
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ permission_manager
+ ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ origin, origin)
+ .content_setting);
// (2) Disable the permission when the default is to ask (expected to clear).
controller()->SetNotifierEnabled(enabled_notifier, false);
- EXPECT_EQ(blink::mojom::PermissionStatus::ASK,
- permission_manager->GetPermissionStatus(
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin));
+ EXPECT_EQ(CONTENT_SETTING_ASK,
+ permission_manager
+ ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ origin, origin)
+ .content_setting);
// Change the default content setting vaule for notifications to ALLOW.
HostContentSettingsMapFactory::GetForProfile(profile)
@@ -332,15 +337,19 @@ TEST_F(MessageCenterSettingsControllerTest, SetWebPageNotifierEnabled) {
// (3) Disable the permission when the default is allowed (expected to set).
controller()->SetNotifierEnabled(enabled_notifier, false);
- EXPECT_EQ(blink::mojom::PermissionStatus::DENIED,
- permission_manager->GetPermissionStatus(
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ permission_manager
+ ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ origin, origin)
+ .content_setting);
// (4) Enable the permission when the default is allowed (expected to clear).
controller()->SetNotifierEnabled(disabled_notifier, true);
- EXPECT_EQ(blink::mojom::PermissionStatus::GRANTED,
- permission_manager->GetPermissionStatus(
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin));
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ permission_manager
+ ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ origin, origin)
+ .content_setting);
// Now change the default content setting value to BLOCK.
HostContentSettingsMapFactory::GetForProfile(profile)
@@ -349,13 +358,17 @@ TEST_F(MessageCenterSettingsControllerTest, SetWebPageNotifierEnabled) {
// (5) Enable the permission when the default is blocked (expected to set).
controller()->SetNotifierEnabled(disabled_notifier, true);
- EXPECT_EQ(blink::mojom::PermissionStatus::GRANTED,
- permission_manager->GetPermissionStatus(
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin));
+ EXPECT_EQ(CONTENT_SETTING_ALLOW,
+ permission_manager
+ ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ origin, origin)
+ .content_setting);
// (6) Disable the permission when the default is blocked (expected to clear).
controller()->SetNotifierEnabled(enabled_notifier, false);
- EXPECT_EQ(blink::mojom::PermissionStatus::DENIED,
- permission_manager->GetPermissionStatus(
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin));
+ EXPECT_EQ(CONTENT_SETTING_BLOCK,
+ permission_manager
+ ->GetPermissionStatus(CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
+ origin, origin)
+ .content_setting);
}

Powered by Google App Engine
This is Rietveld 408576698