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

Unified Diff: chrome/browser/permissions/permission_manager_unittest.cc

Issue 1373883003: Move geolocation and permission mojoms into components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/permissions/permission_manager_unittest.cc
diff --git a/chrome/browser/permissions/permission_manager_unittest.cc b/chrome/browser/permissions/permission_manager_unittest.cc
index ab5561f20a278c33208ae4afeb94afd79b64c215..7a27e03f15498480be5290d5a8f5534da3282e0d 100644
--- a/chrome/browser/permissions/permission_manager_unittest.cc
+++ b/chrome/browser/permissions/permission_manager_unittest.cc
@@ -13,7 +13,6 @@
#include "testing/gtest/include/gtest/gtest.h"
using content::PermissionType;
-using content::PermissionStatus;
namespace {
@@ -33,7 +32,7 @@ class PermissionManagerTestingProfile final : public TestingProfile {
class PermissionManagerTest : public testing::Test {
public:
- void OnPermissionChange(PermissionStatus permission) {
+ void OnPermissionChange(permission::Status permission) {
callback_called_ = true;
callback_result_ = permission;
}
@@ -43,8 +42,7 @@ class PermissionManagerTest : public testing::Test {
: url_("https://example.com"),
other_url_("https://foo.com"),
callback_called_(false),
- callback_result_(content::PERMISSION_STATUS_ASK) {
- }
+ callback_result_(permission::STATUS_ASK) {}
PermissionManager* GetPermissionManager() {
return profile_.GetPermissionManager();
@@ -54,8 +52,7 @@ class PermissionManagerTest : public testing::Test {
return HostContentSettingsMapFactory::GetForProfile(&profile_);
}
- void CheckPermissionStatus(PermissionType type,
- PermissionStatus expected) {
+ void CheckPermissionStatus(PermissionType type, permission::Status expected) {
EXPECT_EQ(expected, GetPermissionManager()->GetPermissionStatus(
type, url_.GetOrigin(), url_.GetOrigin()));
}
@@ -79,59 +76,54 @@ class PermissionManagerTest : public testing::Test {
return callback_called_;
}
- PermissionStatus callback_result() const { return callback_result_; }
+ permission::Status callback_result() const { return callback_result_; }
void Reset() {
callback_called_ = false;
- callback_result_ = content::PERMISSION_STATUS_ASK;
+ callback_result_ = permission::STATUS_ASK;
}
private:
const GURL url_;
const GURL other_url_;
bool callback_called_;
- PermissionStatus callback_result_;
+ permission::Status callback_result_;
content::TestBrowserThreadBundle thread_bundle_;
PermissionManagerTestingProfile profile_;
};
TEST_F(PermissionManagerTest, GetPermissionStatusDefault) {
- CheckPermissionStatus(PermissionType::MIDI_SYSEX,
- content::PERMISSION_STATUS_ASK);
- CheckPermissionStatus(PermissionType::PUSH_MESSAGING,
- content::PERMISSION_STATUS_ASK);
- CheckPermissionStatus(PermissionType::NOTIFICATIONS,
- content::PERMISSION_STATUS_ASK);
- CheckPermissionStatus(PermissionType::GEOLOCATION,
- content::PERMISSION_STATUS_ASK);
+ CheckPermissionStatus(PermissionType::MIDI_SYSEX, permission::STATUS_ASK);
+ CheckPermissionStatus(PermissionType::PUSH_MESSAGING, permission::STATUS_ASK);
+ CheckPermissionStatus(PermissionType::NOTIFICATIONS, permission::STATUS_ASK);
+ CheckPermissionStatus(PermissionType::GEOLOCATION, permission::STATUS_ASK);
#if defined(OS_ANDROID)
CheckPermissionStatus(PermissionType::PROTECTED_MEDIA_IDENTIFIER,
- content::PERMISSION_STATUS_ASK);
+ permission::STATUS_ASK);
#endif
}
TEST_F(PermissionManagerTest, GetPermissionStatusAfterSet) {
SetPermission(CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW);
CheckPermissionStatus(PermissionType::GEOLOCATION,
- content::PERMISSION_STATUS_GRANTED);
+ permission::STATUS_GRANTED);
SetPermission(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_ALLOW);
CheckPermissionStatus(PermissionType::NOTIFICATIONS,
- content::PERMISSION_STATUS_GRANTED);
+ permission::STATUS_GRANTED);
SetPermission(CONTENT_SETTINGS_TYPE_MIDI_SYSEX, CONTENT_SETTING_ALLOW);
- CheckPermissionStatus(PermissionType::MIDI_SYSEX,
- content::PERMISSION_STATUS_GRANTED);
+ CheckPermissionStatus(PermissionType::MIDI_SYSEX, permission::STATUS_GRANTED);
SetPermission(CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, CONTENT_SETTING_ALLOW);
CheckPermissionStatus(PermissionType::PUSH_MESSAGING,
- content::PERMISSION_STATUS_GRANTED);
+ permission::STATUS_GRANTED);
#if defined(OS_ANDROID)
SetPermission(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER,
CONTENT_SETTING_ALLOW);
CheckPermissionStatus(PermissionType::PROTECTED_MEDIA_IDENTIFIER,
- content::PERMISSION_STATUS_GRANTED);
+ permission::STATUS_GRANTED);
#endif
}
@@ -149,7 +141,7 @@ TEST_F(PermissionManagerTest, SameTypeChangeNotifies) {
CONTENT_SETTING_ALLOW);
EXPECT_TRUE(callback_called());
- EXPECT_EQ(content::PERMISSION_STATUS_GRANTED, callback_result());
+ EXPECT_EQ(permission::STATUS_GRANTED, callback_result());
GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id);
}
@@ -240,7 +232,7 @@ TEST_F(PermissionManagerTest, WildCardPatternNotifies) {
CONTENT_SETTING_ALLOW);
EXPECT_TRUE(callback_called());
- EXPECT_EQ(content::PERMISSION_STATUS_GRANTED, callback_result());
+ EXPECT_EQ(permission::STATUS_GRANTED, callback_result());
GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id);
}
@@ -262,7 +254,7 @@ TEST_F(PermissionManagerTest, ClearSettingsNotifies) {
CONTENT_SETTINGS_TYPE_GEOLOCATION);
EXPECT_TRUE(callback_called());
- EXPECT_EQ(content::PERMISSION_STATUS_ASK, callback_result());
+ EXPECT_EQ(permission::STATUS_ASK, callback_result());
GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id);
}
@@ -281,7 +273,7 @@ TEST_F(PermissionManagerTest, NewValueCorrectlyPassed) {
CONTENT_SETTING_BLOCK);
EXPECT_TRUE(callback_called());
- EXPECT_EQ(content::PERMISSION_STATUS_DENIED, callback_result());
+ EXPECT_EQ(permission::STATUS_DENIED, callback_result());
GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id);
}
@@ -332,7 +324,7 @@ TEST_F(PermissionManagerTest, ChangesBackAndForth) {
CONTENT_SETTING_ALLOW);
EXPECT_TRUE(callback_called());
- EXPECT_EQ(content::PERMISSION_STATUS_GRANTED, callback_result());
+ EXPECT_EQ(permission::STATUS_GRANTED, callback_result());
Reset();
@@ -344,7 +336,7 @@ TEST_F(PermissionManagerTest, ChangesBackAndForth) {
CONTENT_SETTING_ASK);
EXPECT_TRUE(callback_called());
- EXPECT_EQ(content::PERMISSION_STATUS_ASK, callback_result());
+ EXPECT_EQ(permission::STATUS_ASK, callback_result());
GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id);
}
« no previous file with comments | « chrome/browser/permissions/permission_manager.cc ('k') | chrome/browser/push_messaging/push_messaging_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698