Index: chrome/browser/media/router/discovery/dial/dial_registry.h |
diff --git a/chrome/browser/media/router/discovery/dial/dial_registry.h b/chrome/browser/media/router/discovery/dial/dial_registry.h |
index 962533727f4aa2ac641f5e6d53c7594fd342b048..55281e0e06ccf3fb71b586d6386e4883852548e5 100644 |
--- a/chrome/browser/media/router/discovery/dial/dial_registry.h |
+++ b/chrome/browser/media/router/discovery/dial/dial_registry.h |
@@ -17,12 +17,15 @@ |
#include "base/macros.h" |
#include "base/memory/singleton.h" |
#include "base/observer_list.h" |
-#include "base/time/time.h" |
#include "base/timer/timer.h" |
#include "chrome/browser/media/router/discovery/dial/dial_service.h" |
#include "chrome/browser/profiles/profile.h" |
#include "net/base/network_change_notifier.h" |
+namespace base { |
+class Clock; |
+} |
+ |
namespace media_router { |
// Keeps track of devices that have responded to discovery requests and notifies |
@@ -85,14 +88,14 @@ class DialRegistry : public DialService::Observer, |
// removed by PruneExpiredDevices(). |
void AddDeviceForTest(const DialDeviceData& device_data); |
+ // Allows tests to swap in a fake clock. |
+ void SetClockForTest(std::unique_ptr<base::Clock> clock); |
+ |
protected: |
// Returns a new instance of the DIAL service. Overridden by tests. |
virtual std::unique_ptr<DialService> CreateDialService(); |
virtual void ClearDialService(); |
- // Returns the current time. Overridden by tests. |
- virtual base::Time Now() const; |
- |
// The DIAL service. Periodic discovery is active when this is not NULL. |
std::unique_ptr<DialService> dial_; |
@@ -189,6 +192,8 @@ class DialRegistry : public DialService::Observer, |
// DIAL API owns this DIAL registry. |
base::ObserverList<Observer> observers_; |
+ std::unique_ptr<base::Clock> clock_; |
+ |
FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestAddRemoveListeners); |
FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestNoDevicesDiscovered); |
FRIEND_TEST_ALL_PREFIXES(DialRegistryTest, TestDevicesDiscovered); |