Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/extensions/api/mdns/mdns_apitest.cc

Issue 1005903005: Cap chrome.mdns.onServiceList listeners per extension at 10 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto HEAD and consolidate changes into one commit Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/api/mdns.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/api/mdns.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698