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

Side by Side Diff: chrome/utility/local_discovery/service_discovery_client_unittest.cc

Issue 137343005: Send multiple queries when DiscoverNewServices is called on a service watcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/utility/local_discovery/service_discovery_client_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/utility/local_discovery/service_discovery_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698