Index: chrome/browser/geolocation/geolocation_browsertest.cc |
diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc |
index 3694e2259996f4a978ec1f8c5f5e1742bc1fb1c4..aae3905e0067d7fa3ec90ad240b934b91fa1bb66 100644 |
--- a/chrome/browser/geolocation/geolocation_browsertest.cc |
+++ b/chrome/browser/geolocation/geolocation_browsertest.cc |
@@ -8,11 +8,14 @@ |
#include "chrome/browser/browser_list.h" |
#include "chrome/browser/geolocation/location_arbitrator.h" |
#include "chrome/browser/geolocation/mock_location_provider.h" |
+#include "chrome/browser/host_content_settings_map.h" |
#include "chrome/browser/profile.h" |
#include "chrome/browser/renderer_host/render_view_host.h" |
#include "chrome/browser/tab_contents/tab_contents.h" |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_switches.h" |
+#include "chrome/common/content_settings.h" |
+#include "chrome/common/content_settings_types.h" |
#include "chrome/common/geoposition.h" |
#include "chrome/common/notification_details.h" |
#include "chrome/common/notification_service.h" |
@@ -222,7 +225,6 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_ErrorOnPermissionDenied) { |
#endif |
IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForSecondTab) { |
-#if 0 |
// TODO(bulach): enable this test once we use HostContentSettingsMap instead |
// of files. |
Initialize(INITIALIZATION_NONE); |
@@ -232,7 +234,6 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForSecondTab) { |
Initialize(INITIALIZATION_NEWTAB); |
SendGeoposition(false, Geoposition()); |
CheckValueFromJavascript("0", "geoGetLastError()"); |
-#endif |
} |
#if defined(OS_MACOSX) |
@@ -244,19 +245,16 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForSecondTab) { |
#endif |
IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForDeniedOrigin) { |
-#if 0 |
- // TODO(bulach): enable this test once we use HostContentSettingsMap instead |
- // of files. |
- WritePermissionFile("{\"allowed\":false}"); |
// Checks no infobar will be created. |
Initialize(INITIALIZATION_NONE); |
+ current_browser_->profile()->GetHostContentSettingsMap()->SetContentSetting( |
+ "localhost", CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_BLOCK); |
SendGeoposition(false, Geoposition()); |
CheckValueFromJavascript("1", "geoGetLastError()"); |
// Checks infobar will not be created a second tab. |
Initialize(INITIALIZATION_NEWTAB); |
SendGeoposition(false, Geoposition()); |
CheckValueFromJavascript("1", "geoGetLastError()"); |
-#endif |
} |
#if defined(OS_MACOSX) |
@@ -269,15 +267,12 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForDeniedOrigin) { |
IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, |
MAYBE_NoInfobarForAllowedOrigin) { |
-#if 0 |
- // TODO(bulach): enable this test once we use HostContentSettingsMap instead |
- // of files. |
- WritePermissionFile("{\"allowed\":true}"); |
// Checks no infobar will be created and there's no error callback. |
Initialize(INITIALIZATION_NONE); |
+ current_browser_->profile()->GetHostContentSettingsMap()->SetContentSetting( |
+ "localhost", CONTENT_SETTINGS_TYPE_GEOLOCATION, CONTENT_SETTING_ALLOW); |
SendGeoposition(false, Geoposition()); |
CheckValueFromJavascript("0", "geoGetLastError()"); |
-#endif |
} |
#if defined(OS_MACOSX) |
@@ -288,18 +283,17 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, |
#define MAYBE_InfobarForOffTheRecord InfobarForOffTheRecord |
#endif |
-IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_InfobarForOffTheRecord) { |
+IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_NoInfobarForOffTheRecord) { |
// Checks infobar will be created for regular profile. |
Initialize(INITIALIZATION_NONE); |
SendGeoposition(true, Geoposition()); |
SetInfobarResponse(true); |
CheckValueFromJavascript("0", "geoGetLastError()"); |
- // Go off the record, and checks infobar will be created and an error callback |
- // is triggered. |
+ // Go off the record, and checks no infobar will be created and no error |
+ // callback is triggered. |
Initialize(INITIALIZATION_OFFTHERECORD); |
- SendGeoposition(true, Geoposition()); |
- SetInfobarResponse(false); |
- CheckValueFromJavascript("1", "geoGetLastError()"); |
+ SendGeoposition(false, Geoposition()); |
+ CheckValueFromJavascript("0", "geoGetLastError()"); |
} |
#if defined(OS_MACOSX) |