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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 DnsSdRegistry::DnsSdServiceList services; | 135 DnsSdRegistry::DnsSdServiceList services; |
136 | 136 |
137 extensions::DnsSdService service; | 137 extensions::DnsSdService service; |
138 service.service_name = service_type; | 138 service.service_name = service_type; |
139 services.push_back(service); | 139 services.push_back(service); |
140 | 140 |
141 dns_sd_registry_->DispatchMDnsEvent(service_type, services); | 141 dns_sd_registry_->DispatchMDnsEvent(service_type, services); |
142 dns_sd_registry_->DispatchMDnsEvent(test_service_type, services); | 142 dns_sd_registry_->DispatchMDnsEvent(test_service_type, services); |
143 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 143 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
144 } | 144 } |
| 145 |
| 146 // TODO(justinlin): Win Dbg has a workaround that makes RunExtensionSubtest |
| 147 // always return true without actually running the test. Remove when fixed. |
| 148 #if defined(OS_WIN) && !defined(NDEBUG) |
| 149 #define MAYBE_RegisterTooManyListeners DISABLED_RegisterTooManyListeners |
| 150 #else |
| 151 #define MAYBE_RegisterTooManyListeners RegisterTooManyListeners |
| 152 #endif |
| 153 // Test loading extension and registering multiple listeners. |
| 154 IN_PROC_BROWSER_TEST_F(MDnsAPITest, MAYBE_RegisterTooManyListeners) { |
| 155 SetUpTestDnsSdRegistry(); |
| 156 |
| 157 EXPECT_CALL(*dns_sd_registry_, RegisterDnsSdListener(A<std::string>())) |
| 158 .Times(10); |
| 159 EXPECT_CALL(*dns_sd_registry_, UnregisterDnsSdListener(A<std::string>())) |
| 160 .Times(10); |
| 161 EXPECT_CALL(*dns_sd_registry_, |
| 162 RemoveObserver(A<extensions::DnsSdRegistry::DnsSdObserver*>())) |
| 163 .Times(1); |
| 164 |
| 165 EXPECT_TRUE(RunPlatformAppTest("mdns/api-packaged-apps")) |
| 166 << message_; |
| 167 } |
OLD | NEW |