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 "chrome/browser/extensions/api/mdns/dns_sd_registry.h" | 5 #include "chrome/browser/extensions/api/mdns/dns_sd_registry.h" |
6 #include "chrome/browser/extensions/api/mdns/dns_sd_delegate.h" | 6 #include "chrome/browser/extensions/api/mdns/dns_sd_delegate.h" |
7 #include "chrome/browser/extensions/api/mdns/dns_sd_device_lister.h" | 7 #include "chrome/browser/extensions/api/mdns/dns_sd_device_lister.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 ~TestDnsSdRegistry() override {} | 24 ~TestDnsSdRegistry() override {} |
25 | 25 |
26 MockDnsSdDeviceLister* GetListerForService(const std::string& service_type) { | 26 MockDnsSdDeviceLister* GetListerForService(const std::string& service_type) { |
27 return listers_[service_type]; | 27 return listers_[service_type]; |
28 } | 28 } |
29 | 29 |
30 int GetServiceListenerCount(const std::string& service_type) { | 30 int GetServiceListenerCount(const std::string& service_type) { |
31 if (service_data_map_.find(service_type) == service_data_map_.end()) | 31 if (service_data_map_.find(service_type) == service_data_map_.end()) |
32 return 0; | 32 return 0; |
33 | 33 |
34 return service_data_map_[service_type].get()->GetListenerCount(); | 34 return service_data_map_[service_type]->GetListenerCount(); |
35 } | 35 } |
36 | 36 |
37 MockDnsSdDeviceLister* GetLister(const std::string& service_type) { | 37 MockDnsSdDeviceLister* GetLister(const std::string& service_type) { |
38 return listers_.find(service_type) != listers_.end() | 38 return listers_.find(service_type) != listers_.end() |
39 ? listers_[service_type] | 39 ? listers_[service_type] |
40 : nullptr; | 40 : nullptr; |
41 } | 41 } |
42 | 42 |
43 DnsSdDelegate* GetDelegate() { | 43 DnsSdDelegate* GetDelegate() { |
44 return delegate_; | 44 return delegate_; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 service.ip_address = "192.168.0.100"; | 255 service.ip_address = "192.168.0.100"; |
256 registry_->GetDelegate()->ServiceChanged(service_type, true, service); | 256 registry_->GetDelegate()->ServiceChanged(service_type, true, service); |
257 // Update with changed ip address. | 257 // Update with changed ip address. |
258 service.ip_address = "192.168.0.101"; | 258 service.ip_address = "192.168.0.101"; |
259 registry_->GetDelegate()->ServiceChanged(service_type, false, service); | 259 registry_->GetDelegate()->ServiceChanged(service_type, false, service); |
260 // Update with no changes to the service. | 260 // Update with no changes to the service. |
261 registry_->GetDelegate()->ServiceChanged(service_type, false, service); | 261 registry_->GetDelegate()->ServiceChanged(service_type, false, service); |
262 } | 262 } |
263 | 263 |
264 } // namespace extensions | 264 } // namespace extensions |
OLD | NEW |