OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/memory/weak_ptr.h" | 5 #include "base/memory/weak_ptr.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "chrome/common/local_discovery/service_discovery_client_impl.h" | 7 #include "chrome/common/local_discovery/service_discovery_client_impl.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "net/dns/dns_protocol.h" | 9 #include "net/dns/dns_protocol.h" |
10 #include "net/dns/mdns_client_impl.h" | 10 #include "net/dns/mdns_client_impl.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 }; | 201 }; |
202 | 202 |
203 class ServiceDiscoveryTest : public ::testing::Test { | 203 class ServiceDiscoveryTest : public ::testing::Test { |
204 public: | 204 public: |
205 ServiceDiscoveryTest() | 205 ServiceDiscoveryTest() |
206 : service_discovery_client_(&mdns_client_) { | 206 : service_discovery_client_(&mdns_client_) { |
207 mdns_client_.StartListening(&socket_factory_); | 207 mdns_client_.StartListening(&socket_factory_); |
208 } | 208 } |
209 | 209 |
210 virtual ~ServiceDiscoveryTest() { | 210 ~ServiceDiscoveryTest() override {} |
211 } | |
212 | 211 |
213 protected: | 212 protected: |
214 void RunFor(base::TimeDelta time_period) { | 213 void RunFor(base::TimeDelta time_period) { |
215 base::CancelableCallback<void()> callback(base::Bind( | 214 base::CancelableCallback<void()> callback(base::Bind( |
216 &ServiceDiscoveryTest::Stop, base::Unretained(this))); | 215 &ServiceDiscoveryTest::Stop, base::Unretained(this))); |
217 base::MessageLoop::current()->PostDelayedTask( | 216 base::MessageLoop::current()->PostDelayedTask( |
218 FROM_HERE, callback.callback(), time_period); | 217 FROM_HERE, callback.callback(), time_period); |
219 | 218 |
220 base::MessageLoop::current()->Run(); | 219 base::MessageLoop::current()->Run(); |
221 callback.Cancel(); | 220 callback.Cancel(); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 ServiceResolver::STATUS_REQUEST_TIMEOUT, _, _, _)); | 508 ServiceResolver::STATUS_REQUEST_TIMEOUT, _, _, _)); |
510 | 509 |
511 // TODO(noamsml): When NSEC record support is added, change this to use an | 510 // TODO(noamsml): When NSEC record support is added, change this to use an |
512 // NSEC record. | 511 // NSEC record. |
513 RunFor(base::TimeDelta::FromSeconds(4)); | 512 RunFor(base::TimeDelta::FromSeconds(4)); |
514 }; | 513 }; |
515 | 514 |
516 } // namespace | 515 } // namespace |
517 | 516 |
518 } // namespace local_discovery | 517 } // namespace local_discovery |
OLD | NEW |