Chromium Code Reviews| Index: components/offline_pages/offline_page_storage_manager.h |
| diff --git a/components/offline_pages/offline_page_storage_manager.h b/components/offline_pages/offline_page_storage_manager.h |
| index cf1dc7f6c9f4fb679194b374f91773d34302a0db..0a2cb660362e1d551c634f90637a8076d4b7c8d3 100644 |
| --- a/components/offline_pages/offline_page_storage_manager.h |
| +++ b/components/offline_pages/offline_page_storage_manager.h |
| @@ -14,6 +14,10 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "components/offline_pages/offline_page_types.h" |
| +namespace base { |
| +class Clock; |
| +} |
| + |
| namespace offline_pages { |
| class ClientPolicyController; |
| @@ -57,6 +61,8 @@ class OfflinePageStorageManager { |
| void ClearPagesIfNeeded(const ClearPageCallback& callback); |
| private: |
| + friend class OfflinePageStorageManagerTest; |
| + |
| // Selects and removes pages that need to be expired. Triggered as a callback |
| // to |GetAllPages|. |
| void ClearExpiredPages(const ClearPageCallback& callback, |
| @@ -74,8 +80,11 @@ class OfflinePageStorageManager { |
| // Determine if manager should clear pages. |
| bool ShouldClearPages(); |
| - // Return true if |page| is expired. |
| - bool IsPageExpired(const OfflinePageItem& page); |
| + // Return true if |page| is expired comparing to |now|. |
| + bool ShouldBeExpired(const base::Time& now, const OfflinePageItem& page); |
| + |
| + // Sets the clock for testing. |
| + void SetClockForTesting(std::unique_ptr<base::Clock> clock); |
|
fgorski
2016/05/12 22:34:25
make this public and don't friend the test class.
romax
2016/05/12 23:31:20
Done.
|
| // Not owned. |
| Client* client_; |
| @@ -85,6 +94,9 @@ class OfflinePageStorageManager { |
| bool in_progress_; |
| + // Clock for getting time. |
| + std::unique_ptr<base::Clock> clock_; |
| + |
| base::WeakPtrFactory<OfflinePageStorageManager> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(OfflinePageStorageManager); |