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

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

Issue 1530403002: Removal of geolocation APIs on insecure origins (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Rebase on ToT Created 4 years, 11 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/geolocation_permission_context_unittest.cc
diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
index 3b2f58aac3de01d5e99e45485b4f5a4c7a458c08..02e9dc504c3c4ad90565f7d13205fe1e1d074f6e 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -385,7 +385,7 @@ base::string16 GeolocationPermissionContextTests::GetPromptText() {
// Tests ----------------------------------------------------------------------
TEST_F(GeolocationPermissionContextTests, SinglePermissionBubble) {
- GURL requesting_frame("http://www.example.com/geolocation");
+ GURL requesting_frame("https://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
BubbleManagerDocumentLoadCompleted();
@@ -395,9 +395,21 @@ TEST_F(GeolocationPermissionContextTests, SinglePermissionBubble) {
ASSERT_EQ(1U, GetNumberOfPrompts());
}
+TEST_F(GeolocationPermissionContextTests,
+ SinglePermissionBubbleFailsOnInsecureOrigin) {
+ GURL requesting_frame("http://www.example.com/geolocation");
+ NavigateAndCommit(requesting_frame);
+ BubbleManagerDocumentLoadCompleted();
+
+ EXPECT_EQ(0U, GetNumberOfPrompts());
+ RequestGeolocationPermission(web_contents(), RequestID(0), requesting_frame,
+ true);
+ ASSERT_EQ(0U, GetNumberOfPrompts());
+}
+
#if BUILDFLAG(ANDROID_JAVA_UI)
TEST_F(GeolocationPermissionContextTests, SinglePermissionInfobar) {
- GURL requesting_frame("http://www.example.com/geolocation");
+ GURL requesting_frame("https://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
EXPECT_EQ(0U, infobar_service()->infobar_count());
RequestGeolocationPermission(
@@ -415,7 +427,7 @@ TEST_F(GeolocationPermissionContextTests, SinglePermissionInfobar) {
// Infobar-only tests; Android doesn't support permission bubbles.
TEST_F(GeolocationPermissionContextTests, GeolocationEnabledDisabled) {
- GURL requesting_frame("http://www.example.com/geolocation");
+ GURL requesting_frame("https://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
MockLocationSettings::SetLocationStatus(true, true);
EXPECT_EQ(0U, infobar_service()->infobar_count());
@@ -437,7 +449,7 @@ TEST_F(GeolocationPermissionContextTests, GeolocationEnabledDisabled) {
}
TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsEnabled) {
- GURL requesting_frame("http://www.example.com/geolocation");
+ GURL requesting_frame("https://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
MockLocationSettings::SetLocationStatus(true, true);
EXPECT_EQ(0U, infobar_service()->infobar_count());
@@ -453,7 +465,7 @@ TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsEnabled) {
}
TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsDisabled) {
- GURL requesting_frame("http://www.example.com/geolocation");
+ GURL requesting_frame("https://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
MockLocationSettings::SetLocationStatus(true, false);
EXPECT_EQ(0U, infobar_service()->infobar_count());
@@ -464,8 +476,8 @@ TEST_F(GeolocationPermissionContextTests, MasterEnabledGoogleAppsDisabled) {
#endif
TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
- GURL requesting_frame_0("http://www.example.com/geolocation");
- GURL requesting_frame_1("http://www.example-2.com/geolocation");
+ GURL requesting_frame_0("https://www.example.com/geolocation");
+ GURL requesting_frame_1("https://www.example-2.com/geolocation");
EXPECT_EQ(
CONTENT_SETTING_ASK,
GetGeolocationContentSetting(requesting_frame_0, requesting_frame_1));
@@ -530,8 +542,8 @@ TEST_F(GeolocationPermissionContextTests, QueuedPermission) {
}
TEST_F(GeolocationPermissionContextTests, HashIsIgnored) {
- GURL url_a("http://www.example.com/geolocation#a");
- GURL url_b("http://www.example.com/geolocation#b");
+ GURL url_a("https://www.example.com/geolocation#a");
+ GURL url_b("https://www.example.com/geolocation#b");
// Navigate to the first url.
NavigateAndCommit(url_a);
@@ -597,8 +609,8 @@ TEST_F(GeolocationPermissionContextTests, MAYBE_PermissionForFileScheme) {
}
TEST_F(GeolocationPermissionContextTests, CancelGeolocationPermissionRequest) {
- GURL frame_0("http://www.example.com/geolocation");
- GURL frame_1("http://www.example-2.com/geolocation");
+ GURL frame_0("https://www.example.com/geolocation");
+ GURL frame_1("https://www.example-2.com/geolocation");
EXPECT_EQ(
CONTENT_SETTING_ASK, GetGeolocationContentSetting(frame_0, frame_0));
EXPECT_EQ(
@@ -662,8 +674,8 @@ TEST_F(GeolocationPermissionContextTests, InvalidURL) {
}
TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
- GURL url_a("http://www.example.com/geolocation");
- GURL url_b("http://www.example-2.com/geolocation");
+ GURL url_a("https://www.example.com/geolocation");
+ GURL url_b("https://www.example-2.com/geolocation");
NavigateAndCommit(url_a); // Tab A0
AddNewTab(url_b); // Tab B (extra_tabs_[0])
AddNewTab(url_a); // Tab A1 (extra_tabs_[1])
@@ -723,8 +735,8 @@ TEST_F(GeolocationPermissionContextTests, SameOriginMultipleTabs) {
}
TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
- GURL url_a("http://www.example.com/geolocation");
- GURL url_b("http://www.example-2.com/geolocation");
+ GURL url_a("https://www.example.com/geolocation");
+ GURL url_b("https://www.example-2.com/geolocation");
NavigateAndCommit(url_a); // Tab A0.
AddNewTab(url_a); // Tab A1.
#if !BUILDFLAG(ANDROID_JAVA_UI)
@@ -798,8 +810,8 @@ TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
}
TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
- GURL requesting_frame_0("http://www.example.com/geolocation");
- GURL requesting_frame_1("http://www.example-2.com/geolocation");
+ GURL requesting_frame_0("https://www.example.com/geolocation");
+ GURL requesting_frame_1("https://www.example-2.com/geolocation");
EXPECT_EQ(
CONTENT_SETTING_ASK,
GetGeolocationContentSetting(requesting_frame_0, requesting_frame_0));
@@ -837,7 +849,7 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
}
TEST_F(GeolocationPermissionContextTests, LastUsageAudited) {
- GURL requesting_frame("http://www.example.com/geolocation");
+ GURL requesting_frame("https://www.example.com/geolocation");
NavigateAndCommit(requesting_frame);
BubbleManagerDocumentLoadCompleted();
@@ -889,8 +901,8 @@ TEST_F(GeolocationPermissionContextTests, LastUsageAuditedMultipleFrames) {
HostContentSettingsMapFactory::GetForProfile(profile());
map->SetPrefClockForTesting(scoped_ptr<base::Clock>(test_clock));
- GURL requesting_frame_0("http://www.example.com/geolocation");
- GURL requesting_frame_1("http://www.example-2.com/geolocation");
+ GURL requesting_frame_0("https://www.example.com/geolocation");
+ GURL requesting_frame_1("https://www.example-2.com/geolocation");
// The permission shouldn't have been used yet.
EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
« no previous file with comments | « chrome/browser/geolocation/geolocation_permission_context.cc ('k') | content/public/common/common_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698