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

Unified Diff: chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc

Issue 7484072: Migrate geolocation settings to host content settings map. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 4 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/geolocation/chrome_geolocation_permission_context_unittest.cc
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
index 5578bfeb77a5ea52fde812675589ac5818ef7e10..3109341892f0a64dd122da90081325ba7c6655df 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
@@ -3,11 +3,12 @@
// found in the LICENSE file.
#include <set>
+#include <string>
#include "base/memory/scoped_vector.h"
+#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
-#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/tab_contents/infobar.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
@@ -227,11 +228,18 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
GURL requesting_frame_0("http://www.example.com/geolocation");
GURL requesting_frame_1("http://www.example-2.com/geolocation");
EXPECT_EQ(CONTENT_SETTING_ASK,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_0, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_0,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
EXPECT_EQ(CONTENT_SETTING_ASK,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_1, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_1,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
+
NavigateAndCommit(requesting_frame_0);
EXPECT_EQ(0U, contents_wrapper()->infobar_count());
@@ -277,22 +285,37 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
EXPECT_EQ(0U, contents_wrapper()->infobar_count());
// Ensure the persisted permissions are ok.
EXPECT_EQ(CONTENT_SETTING_ALLOW,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_0, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_0,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
+
EXPECT_EQ(CONTENT_SETTING_BLOCK,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_1, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_1,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
}
TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
GURL requesting_frame_0("http://www.example.com/geolocation");
GURL requesting_frame_1("http://www.example-2.com/geolocation");
EXPECT_EQ(CONTENT_SETTING_ASK,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_0, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_0,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
+
EXPECT_EQ(CONTENT_SETTING_ASK,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_1, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_1,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
+
NavigateAndCommit(requesting_frame_0);
EXPECT_EQ(0U, contents_wrapper()->infobar_count());
@@ -335,11 +358,18 @@ TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
EXPECT_EQ(0U, contents_wrapper()->infobar_count());
// Ensure the persisted permissions are ok.
EXPECT_EQ(CONTENT_SETTING_ASK,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_0, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_0,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
+
EXPECT_EQ(CONTENT_SETTING_ALLOW,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_1, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_1,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
}
TEST_F(GeolocationPermissionContextTests, InvalidURL) {
@@ -469,12 +499,19 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
GURL requesting_frame_1("http://www.example-2.com/geolocation");
EXPECT_EQ(
CONTENT_SETTING_ASK,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_0, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_0,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
+
EXPECT_EQ(
CONTENT_SETTING_ASK,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame_1, requesting_frame_0));
+ profile()->GetHostContentSettingsMap()->GetContentSetting(
+ requesting_frame_1,
+ requesting_frame_0,
+ CONTENT_SETTINGS_TYPE_GEOLOCATION,
+ std::string()));
NavigateAndCommit(requesting_frame_0);
EXPECT_EQ(0U, contents_wrapper()->infobar_count());

Powered by Google App Engine
This is Rietveld 408576698