diff options
-rw-r--r-- | components/history/core/browser/top_sites_impl.cc | 7 | ||||
-rw-r--r-- | components/history/core/browser/top_sites_impl_unittest.cc | 21 |
2 files changed, 24 insertions, 4 deletions
diff --git a/components/history/core/browser/top_sites_impl.cc b/components/history/core/browser/top_sites_impl.cc index 4df526b..22d7810 100644 --- a/components/history/core/browser/top_sites_impl.cc +++ b/components/history/core/browser/top_sites_impl.cc @@ -75,7 +75,14 @@ const int kDaysOfHistory = 90; const int64 kUpdateIntervalSecs = 15; // Intervals between requests to HistoryService. const int64 kMinUpdateIntervalMinutes = 1; +#if !defined(OS_IOS) const int64 kMaxUpdateIntervalMinutes = 60; +#else +// On iOS, having the max at 60 results in the topsites database being +// not updated often enough since the app isn't usually running for long +// stretches of time. +const int64 kMaxUpdateIntervalMinutes = 5; +#endif // !defined(OS_IOS) // Use 100 quality (highest quality) because we're very sensitive to // artifacts for these small sized, highly detailed images. diff --git a/components/history/core/browser/top_sites_impl_unittest.cc b/components/history/core/browser/top_sites_impl_unittest.cc index f57d814..bef691c 100644 --- a/components/history/core/browser/top_sites_impl_unittest.cc +++ b/components/history/core/browser/top_sites_impl_unittest.cc @@ -963,8 +963,20 @@ TEST_F(TopSitesImplTest, DeleteNotifications) { // Makes sure GetUpdateDelay is updated appropriately. TEST_F(TopSitesImplTest, GetUpdateDelay) { +#if defined(OS_IOS) + const int64 kExpectedUpdateDelayInSecondEmpty = 30; + const int64 kExpectedUpdateDelayInSecond0Changed = 5; + const int64 kExpectedUpdateDelayInSecond3Changed = 5; + const int64 kExpectedUpdateDelayInSecond20Changed = 1; +#else + const int64 kExpectedUpdateDelayInSecondEmpty = 30; + const int64 kExpectedUpdateDelayInSecond0Changed = 60; + const int64 kExpectedUpdateDelayInSecond3Changed = 52; + const int64 kExpectedUpdateDelayInSecond20Changed = 1; +#endif + SetLastNumUrlsChanged(0); - EXPECT_EQ(30, GetUpdateDelay().InSeconds()); + EXPECT_EQ(kExpectedUpdateDelayInSecondEmpty, GetUpdateDelay().InSeconds()); MostVisitedURLList url_list; url_list.resize(20); @@ -976,13 +988,14 @@ TEST_F(TopSitesImplTest, GetUpdateDelay) { SetTopSites(url_list); EXPECT_EQ(20u, last_num_urls_changed()); SetLastNumUrlsChanged(0); - EXPECT_EQ(60, GetUpdateDelay().InMinutes()); + EXPECT_EQ(kExpectedUpdateDelayInSecond0Changed, GetUpdateDelay().InMinutes()); SetLastNumUrlsChanged(3); - EXPECT_EQ(52, GetUpdateDelay().InMinutes()); + EXPECT_EQ(kExpectedUpdateDelayInSecond3Changed, GetUpdateDelay().InMinutes()); SetLastNumUrlsChanged(20); - EXPECT_EQ(1, GetUpdateDelay().InMinutes()); + EXPECT_EQ(kExpectedUpdateDelayInSecond20Changed, + GetUpdateDelay().InMinutes()); } // Verifies that callbacks are notified correctly if requested before top sites |