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

Unified Diff: chrome/browser/media/router/discovery/dial/dial_registry.h

Issue 2843653002: [DIAL tests] Slightly improve DialRegistry tests. (Closed)
Patch Set: Addressed mark's comments Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/media/router/discovery/dial/dial_registry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | chrome/browser/media/router/discovery/dial/dial_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698