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

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

Issue 2697473002: Remove last usage functions from HostContentSettingsMap and clean up prefs (Closed)
Patch Set: fix up unit test Created 3 years, 10 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_browsertest.cc
diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc
index 76eb19a5db1e521c81a2620be92fd8b66f1e1ffc..c8d635d7c0e7ecb9c4a49437b6ae691ba526ea10 100644
--- a/chrome/browser/geolocation/geolocation_browsertest.cc
+++ b/chrome/browser/geolocation/geolocation_browsertest.cc
@@ -744,34 +744,3 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, TabDestroyed) {
ASSERT_TRUE(content::ExecuteScript(
current_browser()->tab_strip_model()->GetActiveWebContents(), script));
}
-
-IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, LastUsageUpdated) {
- ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_DEFAULT));
- base::SimpleTestClock* clock_ = new base::SimpleTestClock();
- GetHostContentSettingsMap()->SetPrefClockForTesting(
- std::unique_ptr<base::Clock>(clock_));
- clock_->SetNow(base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(10));
-
- // Setting the permission should trigger the last usage.
- GetHostContentSettingsMap()->SetContentSettingDefaultScope(
- current_url(), current_url(), CONTENT_SETTINGS_TYPE_GEOLOCATION,
- std::string(), CONTENT_SETTING_ALLOW);
-
- // Permission has been used at the starting time.
- EXPECT_EQ(GetHostContentSettingsMap()->GetLastUsage(
- current_url().GetOrigin(),
- current_url().GetOrigin(),
- CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 10);
-
- clock_->Advance(base::TimeDelta::FromSeconds(3));
-
- // Calling watchPosition should trigger the last usage update.
- WatchPositionAndObservePermissionRequest(false);
- ExpectPosition(fake_latitude(), fake_longitude());
-
- // Last usage has been updated.
- EXPECT_EQ(GetHostContentSettingsMap()->GetLastUsage(
- current_url().GetOrigin(),
- current_url().GetOrigin(),
- CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 13);
-}

Powered by Google App Engine
This is Rietveld 408576698