| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |