Index: net/dns/mdns_client_impl.h |
diff --git a/net/dns/mdns_client_impl.h b/net/dns/mdns_client_impl.h |
index 4ed85f24ac7404b1dafc7411a12ef171f0e49090..f5e7e144d526622c1470910160f5ed3885a545c7 100644 |
--- a/net/dns/mdns_client_impl.h |
+++ b/net/dns/mdns_client_impl.h |
@@ -6,6 +6,7 @@ |
#define NET_DNS_MDNS_CLIENT_IMPL_H_ |
#include <map> |
+#include <queue> |
#include <string> |
#include <utility> |
#include <vector> |
@@ -21,11 +22,16 @@ |
#include "net/udp/udp_server_socket.h" |
#include "net/udp/udp_socket.h" |
+namespace base { |
+class Clock; |
+class Timer; |
+} // namespace base |
+ |
namespace net { |
class MDnsSocketFactoryImpl : public MDnsSocketFactory { |
public: |
- MDnsSocketFactoryImpl() {}; |
+ MDnsSocketFactoryImpl() {} |
~MDnsSocketFactoryImpl() override{}; |
void CreateSockets(ScopedVector<DatagramServerSocket>* sockets) override; |
@@ -132,6 +138,8 @@ class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient { |
void OnConnectionError(int error) override; |
private: |
+ FRIEND_TEST_ALL_PREFIXES(MDnsTest, CacheCleanupWithShortTTL); |
+ |
typedef std::pair<std::string, uint16> ListenerKey; |
typedef std::map<ListenerKey, ObserverList<MDnsListenerImpl>* > |
ListenerMap; |
@@ -155,11 +163,16 @@ class NET_EXPORT_PRIVATE MDnsClientImpl : public MDnsClient { |
// list if is empty. |
void CleanupObserverList(const ListenerKey& key); |
+ void set_cleanup_timer_for_test(scoped_ptr<base::Timer> timer); |
+ |
+ void set_clock_for_test(scoped_ptr<base::Clock> clock); |
+ |
ListenerMap listeners_; |
MDnsCache cache_; |
- base::CancelableClosure cleanup_callback_; |
+ scoped_ptr<base::Clock> clock_; |
+ scoped_ptr<base::Timer> cleanup_timer_; |
base::Time scheduled_cleanup_; |
scoped_ptr<MDnsConnection> connection_; |