diff options
author | sdefresne <sdefresne@chromium.org> | 2015-05-12 09:57:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-12 16:58:50 +0000 |
commit | 9d4007a7670c72982a1c3bf6f549f76df325f57b (patch) | |
tree | 8fb3bd4bf935b4ffe9e70ce2557f3df3e592b40b /components/history | |
parent | 0080f370f5b84d094195ebd7e9fb7052524468b8 (diff) | |
download | chromium_src-9d4007a7670c72982a1c3bf6f549f76df325f57b.zip chromium_src-9d4007a7670c72982a1c3bf6f549f76df325f57b.tar.gz chromium_src-9d4007a7670c72982a1c3bf6f549f76df325f57b.tar.bz2 |
[iOS] Reduce UpdateDelay
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. Reduce the value to 5 minutes instead and fix unit
tests.
BUG=485070
Review URL: https://codereview.chromium.org/1133093002
Cr-Commit-Position: refs/heads/master@{#329424}
Diffstat (limited to 'components/history')
-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 |