| 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 d1af54d43a810cfc17e0f2c4fb83749c0677af5f..e733a68e0b40ad92b48346f3f175bf67a32da5ef 100644
|
| --- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
|
| +++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
|
| @@ -871,140 +871,3 @@ TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
|
| CONTENT_SETTING_ASK,
|
| GetGeolocationContentSetting(requesting_frame_1, requesting_frame_0));
|
| }
|
| -
|
| -TEST_F(GeolocationPermissionContextTests, LastUsageAudited) {
|
| - GURL requesting_frame("https://www.example.com/geolocation");
|
| - NavigateAndCommit(requesting_frame);
|
| - RequestManagerDocumentLoadCompleted();
|
| -
|
| - base::SimpleTestClock* test_clock = new base::SimpleTestClock;
|
| - test_clock->SetNow(base::Time::UnixEpoch() +
|
| - base::TimeDelta::FromSeconds(10));
|
| -
|
| - HostContentSettingsMap* map =
|
| - HostContentSettingsMapFactory::GetForProfile(profile());
|
| - map->SetPrefClockForTesting(std::unique_ptr<base::Clock>(test_clock));
|
| -
|
| - // The permission shouldn't have been used yet.
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(),
|
| - requesting_frame.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 0);
|
| - ASSERT_EQ(0U, GetNumberOfPrompts());
|
| - RequestGeolocationPermission(
|
| - web_contents(), RequestID(0), requesting_frame, false);
|
| - ASSERT_EQ(1U, GetNumberOfPrompts());
|
| -
|
| - AcceptPrompt();
|
| - CheckTabContentsState(requesting_frame, CONTENT_SETTING_ALLOW);
|
| - CheckPermissionMessageSent(0, true);
|
| -
|
| - // Permission has been used at the starting time.
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(),
|
| - requesting_frame.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 10);
|
| -
|
| - test_clock->Advance(base::TimeDelta::FromSeconds(3));
|
| - RequestGeolocationPermission(
|
| - web_contents(), RequestID(0), requesting_frame, false);
|
| -
|
| - // Permission has been used three seconds later.
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(),
|
| - requesting_frame.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 13);
|
| -}
|
| -
|
| -TEST_F(GeolocationPermissionContextTests, LastUsageAuditedMultipleFrames) {
|
| - base::SimpleTestClock* test_clock = new base::SimpleTestClock;
|
| - test_clock->SetNow(base::Time::UnixEpoch() +
|
| - base::TimeDelta::FromSeconds(10));
|
| -
|
| - HostContentSettingsMap* map =
|
| - HostContentSettingsMapFactory::GetForProfile(profile());
|
| - map->SetPrefClockForTesting(std::unique_ptr<base::Clock>(test_clock));
|
| -
|
| - 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(),
|
| - requesting_frame_0.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 0);
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
|
| - requesting_frame_0.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 0);
|
| -
|
| - NavigateAndCommit(requesting_frame_0);
|
| - RequestManagerDocumentLoadCompleted();
|
| -
|
| - EXPECT_EQ(0U, GetNumberOfPrompts());
|
| -
|
| - // Request permission for two frames.
|
| - RequestGeolocationPermission(
|
| - web_contents(), RequestID(0), requesting_frame_0, false);
|
| - RequestGeolocationPermission(
|
| - web_contents(), RequestID(1), requesting_frame_1, false);
|
| -
|
| - // Ensure only one infobar is created.
|
| - ASSERT_EQ(1U, GetNumberOfPrompts());
|
| -
|
| - // Accept the first frame.
|
| - AcceptPrompt();
|
| -#if defined(OS_ANDROID)
|
| - infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
|
| -#endif
|
| - CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW);
|
| - CheckPermissionMessageSent(0, true);
|
| -
|
| - // Verify that accepting the first didn't accept because it's embedded
|
| - // in the other.
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
|
| - requesting_frame_0.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 10);
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
|
| - requesting_frame_0.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 0);
|
| -
|
| - ASSERT_EQ(1U, GetNumberOfPrompts());
|
| -
|
| - test_clock->Advance(base::TimeDelta::FromSeconds(1));
|
| -
|
| - // Allow the second frame.
|
| - AcceptPrompt();
|
| - CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_ALLOW);
|
| - CheckPermissionMessageSent(1, true);
|
| -#if defined(OS_ANDROID)
|
| - infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
|
| -#endif
|
| -
|
| - // Verify that the times are different.
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
|
| - requesting_frame_0.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 10);
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
|
| - requesting_frame_0.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 11);
|
| -
|
| - test_clock->Advance(base::TimeDelta::FromSeconds(2));
|
| - RequestGeolocationPermission(
|
| - web_contents(), RequestID(0), requesting_frame_0, false);
|
| -
|
| - // Verify that requesting permission in one frame doesn't update other where
|
| - // it is the embedder.
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
|
| - requesting_frame_0.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 13);
|
| - EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
|
| - requesting_frame_0.GetOrigin(),
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
|
| - 11);
|
| -}
|
|
|