OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/utility/local_discovery/service_discovery_client_impl.h" | 7 #include "chrome/utility/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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 scoped_ptr<ServiceWatcher> watcher( | 239 scoped_ptr<ServiceWatcher> watcher( |
240 service_discovery_client_.CreateServiceWatcher( | 240 service_discovery_client_.CreateServiceWatcher( |
241 "_privet._tcp.local", delegate.GetCallback())); | 241 "_privet._tcp.local", delegate.GetCallback())); |
242 | 242 |
243 watcher->Start(); | 243 watcher->Start(); |
244 | 244 |
245 EXPECT_CALL(socket_factory_, OnSendTo(_)).Times(2); | 245 EXPECT_CALL(socket_factory_, OnSendTo(_)).Times(2); |
246 | 246 |
247 watcher->DiscoverNewServices(false); | 247 watcher->DiscoverNewServices(false); |
| 248 |
| 249 EXPECT_CALL(socket_factory_, OnSendTo(_)).Times(2); |
| 250 |
| 251 RunFor(base::TimeDelta::FromSeconds(2)); |
248 }; | 252 }; |
249 | 253 |
250 TEST_F(ServiceDiscoveryTest, ReadCachedServices) { | 254 TEST_F(ServiceDiscoveryTest, ReadCachedServices) { |
251 socket_factory_.SimulateReceive(kSamplePacketPTR, sizeof(kSamplePacketPTR)); | 255 socket_factory_.SimulateReceive(kSamplePacketPTR, sizeof(kSamplePacketPTR)); |
252 | 256 |
253 StrictMock<MockServiceWatcherClient> delegate; | 257 StrictMock<MockServiceWatcherClient> delegate; |
254 | 258 |
255 scoped_ptr<ServiceWatcher> watcher( | 259 scoped_ptr<ServiceWatcher> watcher( |
256 service_discovery_client_.CreateServiceWatcher( | 260 service_discovery_client_.CreateServiceWatcher( |
257 "_privet._tcp.local", delegate.GetCallback())); | 261 "_privet._tcp.local", delegate.GetCallback())); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 ServiceResolver::STATUS_REQUEST_TIMEOUT, _, _, _)); | 451 ServiceResolver::STATUS_REQUEST_TIMEOUT, _, _, _)); |
448 | 452 |
449 // TODO(noamsml): When NSEC record support is added, change this to use an | 453 // TODO(noamsml): When NSEC record support is added, change this to use an |
450 // NSEC record. | 454 // NSEC record. |
451 RunFor(base::TimeDelta::FromSeconds(4)); | 455 RunFor(base::TimeDelta::FromSeconds(4)); |
452 }; | 456 }; |
453 | 457 |
454 } // namespace | 458 } // namespace |
455 | 459 |
456 } // namespace local_discovery | 460 } // namespace local_discovery |
OLD | NEW |