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

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

Issue 17922002: Add an explicit way of forcing the MDnsClient to listen on the network (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | net/dns/mdns_client.h » ('j') | 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 "chrome/browser/local_discovery/service_discovery_client_impl.h" 6 #include "chrome/browser/local_discovery/service_discovery_client_impl.h"
7 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
8 #include "net/dns/dns_protocol.h" 8 #include "net/dns/dns_protocol.h"
9 #include "net/dns/mdns_client_impl.h" 9 #include "net/dns/mdns_client_impl.h"
10 #include "net/dns/mock_mdns_socket_factory.h" 10 #include "net/dns/mock_mdns_socket_factory.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 }; 144 };
145 145
146 class ServiceDiscoveryTest : public ::testing::Test { 146 class ServiceDiscoveryTest : public ::testing::Test {
147 public: 147 public:
148 ServiceDiscoveryTest() 148 ServiceDiscoveryTest()
149 : socket_factory_(new net::MockMDnsSocketFactory), 149 : socket_factory_(new net::MockMDnsSocketFactory),
150 mdns_client_( 150 mdns_client_(
151 scoped_ptr<net::MDnsConnection::SocketFactory>( 151 scoped_ptr<net::MDnsConnection::SocketFactory>(
152 socket_factory_)) { 152 socket_factory_)) {
153 net::MDnsClient::SetInstance(&mdns_client_); 153 net::MDnsClient::SetInstance(&mdns_client_);
154 mdns_client_.StartListening();
154 } 155 }
155 156
156 virtual ~ServiceDiscoveryTest() { 157 virtual ~ServiceDiscoveryTest() {
157 net::MDnsClient::SetInstance(NULL); 158 net::MDnsClient::SetInstance(NULL);
158 } 159 }
159 160
160 protected: 161 protected:
161 void RunFor(base::TimeDelta time_period) { 162 void RunFor(base::TimeDelta time_period) {
162 base::CancelableCallback<void()> callback(base::Bind( 163 base::CancelableCallback<void()> callback(base::Bind(
163 &ServiceDiscoveryTest::Stop, base::Unretained(this))); 164 &ServiceDiscoveryTest::Stop, base::Unretained(this)));
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 ServiceResolver::STATUS_REQUEST_TIMEOUT)); 460 ServiceResolver::STATUS_REQUEST_TIMEOUT));
460 461
461 // TODO(noamsml): When NSEC record support is added, change this to use an 462 // TODO(noamsml): When NSEC record support is added, change this to use an
462 // NSEC record. 463 // NSEC record.
463 RunFor(base::TimeDelta::FromSeconds(4)); 464 RunFor(base::TimeDelta::FromSeconds(4));
464 }; 465 };
465 466
466 } // namespace 467 } // namespace
467 468
468 } // namespace local_discovery 469 } // namespace local_discovery
OLDNEW
« no previous file with comments | « no previous file | net/dns/mdns_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698