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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/extensions/api/mdns/mdns_api.h" | 6 #include "chrome/browser/extensions/api/mdns/mdns_api.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/common/extensions/api/mdns.h" | 9 #include "chrome/common/extensions/api/mdns.h" |
10 #include "extensions/common/switches.h" | 10 #include "extensions/common/switches.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void SetUpCommandLine(base::CommandLine* command_line) override { | 45 void SetUpCommandLine(base::CommandLine* command_line) override { |
46 ExtensionApiTest::SetUpCommandLine(command_line); | 46 ExtensionApiTest::SetUpCommandLine(command_line); |
47 command_line->AppendSwitchASCII( | 47 command_line->AppendSwitchASCII( |
48 extensions::switches::kWhitelistedExtensionID, | 48 extensions::switches::kWhitelistedExtensionID, |
49 "ddchlicdkolnonkihahngkmmmjnjlkkf"); | 49 "ddchlicdkolnonkihahngkmmmjnjlkkf"); |
50 } | 50 } |
51 | 51 |
52 void SetUpTestDnsSdRegistry() { | 52 void SetUpTestDnsSdRegistry() { |
53 extensions::MDnsAPI* api = extensions::MDnsAPI::Get(profile()); | 53 extensions::MDnsAPI* api = extensions::MDnsAPI::Get(profile()); |
54 dns_sd_registry_ = new MockDnsSdRegistry(api); | 54 dns_sd_registry_ = new MockDnsSdRegistry(api); |
| 55 EXPECT_CALL(*dns_sd_registry_, AddObserver(api)) |
| 56 .Times(1); |
55 // Transfers ownership of the registry instance. | 57 // Transfers ownership of the registry instance. |
56 api->SetDnsSdRegistryForTesting( | 58 api->SetDnsSdRegistryForTesting( |
57 make_scoped_ptr<DnsSdRegistry>(dns_sd_registry_).Pass()); | 59 make_scoped_ptr<DnsSdRegistry>(dns_sd_registry_).Pass()); |
58 } | 60 } |
59 | 61 |
60 protected: | 62 protected: |
61 MockDnsSdRegistry* dns_sd_registry_; | 63 MockDnsSdRegistry* dns_sd_registry_; |
62 }; | 64 }; |
63 | 65 |
64 } // namespace | 66 } // namespace |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 DnsSdRegistry::DnsSdServiceList services; | 135 DnsSdRegistry::DnsSdServiceList services; |
134 | 136 |
135 extensions::DnsSdService service; | 137 extensions::DnsSdService service; |
136 service.service_name = service_type; | 138 service.service_name = service_type; |
137 services.push_back(service); | 139 services.push_back(service); |
138 | 140 |
139 dns_sd_registry_->DispatchMDnsEvent(service_type, services); | 141 dns_sd_registry_->DispatchMDnsEvent(service_type, services); |
140 dns_sd_registry_->DispatchMDnsEvent(test_service_type, services); | 142 dns_sd_registry_->DispatchMDnsEvent(test_service_type, services); |
141 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 143 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
142 } | 144 } |
OLD | NEW |