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 "extensions/browser/event_router.h" | 5 #include "extensions/browser/event_router.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 ExtensionsTest::TearDown(); | 198 ExtensionsTest::TearDown(); |
199 } | 199 } |
200 | 200 |
201 content::RenderProcessHost* render_process_host() const { | 201 content::RenderProcessHost* render_process_host() const { |
202 return render_process_host_.get(); | 202 return render_process_host_.get(); |
203 } | 203 } |
204 | 204 |
205 EventRouter* event_router() { return EventRouter::Get(browser_context()); } | 205 EventRouter* event_router() { return EventRouter::Get(browser_context()); } |
206 | 206 |
207 const DictionaryValue* GetFilteredEvents(const std::string& extension_id) { | 207 const DictionaryValue* GetFilteredEvents(const std::string& extension_id) { |
208 return event_router()->GetFilteredEvents(extension_id); | 208 return event_router()->GetFilteredEvents( |
| 209 extension_id, EventRouter::kRegisteredLazyEvents); |
209 } | 210 } |
210 | 211 |
211 bool ContainsFilter(const std::string& extension_id, | 212 bool ContainsFilter(const std::string& extension_id, |
212 const std::string& event_name, | 213 const std::string& event_name, |
213 const DictionaryValue& to_check) { | 214 const DictionaryValue& to_check) { |
214 const ListValue* filter_list = GetFilterList(extension_id, event_name); | 215 const ListValue* filter_list = GetFilterList(extension_id, event_name); |
215 if (!filter_list) { | 216 if (!filter_list) { |
216 ADD_FAILURE(); | 217 ADD_FAILURE(); |
217 return false; | 218 return false; |
218 } | 219 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 411 |
411 // Remove the third filter. | 412 // Remove the third filter. |
412 event_router()->RemoveFilteredEventListener(kEventName, render_process_host(), | 413 event_router()->RemoveFilteredEventListener(kEventName, render_process_host(), |
413 kExtensionId, *filters[2], true); | 414 kExtensionId, *filters[2], true); |
414 ASSERT_FALSE(ContainsFilter(kExtensionId, kEventName, *filters[0])); | 415 ASSERT_FALSE(ContainsFilter(kExtensionId, kEventName, *filters[0])); |
415 ASSERT_FALSE(ContainsFilter(kExtensionId, kEventName, *filters[1])); | 416 ASSERT_FALSE(ContainsFilter(kExtensionId, kEventName, *filters[1])); |
416 ASSERT_FALSE(ContainsFilter(kExtensionId, kEventName, *filters[2])); | 417 ASSERT_FALSE(ContainsFilter(kExtensionId, kEventName, *filters[2])); |
417 } | 418 } |
418 | 419 |
419 } // namespace extensions | 420 } // namespace extensions |
OLD | NEW |