| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 public: | 72 public: |
| 73 DnsSdRegistryTest() {} | 73 DnsSdRegistryTest() {} |
| 74 ~DnsSdRegistryTest() override {} | 74 ~DnsSdRegistryTest() override {} |
| 75 | 75 |
| 76 void SetUp() override { | 76 void SetUp() override { |
| 77 registry_.reset(new TestDnsSdRegistry()); | 77 registry_.reset(new TestDnsSdRegistry()); |
| 78 registry_->AddObserver(&observer_); | 78 registry_->AddObserver(&observer_); |
| 79 } | 79 } |
| 80 | 80 |
| 81 protected: | 81 protected: |
| 82 scoped_ptr<TestDnsSdRegistry> registry_; | 82 std::unique_ptr<TestDnsSdRegistry> registry_; |
| 83 MockDnsSdObserver observer_; | 83 MockDnsSdObserver observer_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 // Tests registering 2 listeners and removing one. The device lister should | 86 // Tests registering 2 listeners and removing one. The device lister should |
| 87 // not be destroyed. | 87 // not be destroyed. |
| 88 TEST_F(DnsSdRegistryTest, RegisterUnregisterListeners) { | 88 TEST_F(DnsSdRegistryTest, RegisterUnregisterListeners) { |
| 89 const std::string service_type = "_testing._tcp.local"; | 89 const std::string service_type = "_testing._tcp.local"; |
| 90 | 90 |
| 91 EXPECT_CALL(observer_, OnDnsSdEvent(service_type, | 91 EXPECT_CALL(observer_, OnDnsSdEvent(service_type, |
| 92 DnsSdRegistry::DnsSdServiceList())).Times(2); | 92 DnsSdRegistry::DnsSdServiceList())).Times(2); |
| (...skipping 162 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 |