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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 int listener_removed_count() const { return listener_removed_count_; } | 31 int listener_removed_count() const { return listener_removed_count_; } |
32 const std::string& last_event_name() const { return last_event_name_; } | 32 const std::string& last_event_name() const { return last_event_name_; } |
33 | 33 |
34 void Reset() { | 34 void Reset() { |
35 listener_added_count_ = 0; | 35 listener_added_count_ = 0; |
36 listener_removed_count_ = 0; | 36 listener_removed_count_ = 0; |
37 last_event_name_.clear(); | 37 last_event_name_.clear(); |
38 } | 38 } |
39 | 39 |
40 // EventRouter::Observer overrides: | 40 // EventRouter::Observer overrides: |
41 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE { | 41 virtual void OnListenerAdded(const EventListenerInfo& details) override { |
42 listener_added_count_++; | 42 listener_added_count_++; |
43 last_event_name_ = details.event_name; | 43 last_event_name_ = details.event_name; |
44 } | 44 } |
45 | 45 |
46 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE { | 46 virtual void OnListenerRemoved(const EventListenerInfo& details) override { |
47 listener_removed_count_++; | 47 listener_removed_count_++; |
48 last_event_name_ = details.event_name; | 48 last_event_name_ = details.event_name; |
49 } | 49 } |
50 | 50 |
51 private: | 51 private: |
52 int listener_added_count_; | 52 int listener_added_count_; |
53 int listener_removed_count_; | 53 int listener_removed_count_; |
54 std::string last_event_name_; | 54 std::string last_event_name_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(MockEventRouterObserver); | 56 DISALLOW_COPY_AND_ASSIGN(MockEventRouterObserver); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 RunEventRouterObserverTest( | 164 RunEventRouterObserverTest( |
165 base::Bind(&CreateEventListenerForExtension, "extension_id")); | 165 base::Bind(&CreateEventListenerForExtension, "extension_id")); |
166 } | 166 } |
167 | 167 |
168 TEST_F(EventRouterTest, EventRouterObserverForURLs) { | 168 TEST_F(EventRouterTest, EventRouterObserverForURLs) { |
169 RunEventRouterObserverTest( | 169 RunEventRouterObserverTest( |
170 base::Bind(&CreateEventListenerForURL, GURL("http://google.com/path"))); | 170 base::Bind(&CreateEventListenerForURL, GURL("http://google.com/path"))); |
171 } | 171 } |
172 | 172 |
173 } // namespace extensions | 173 } // namespace extensions |
OLD | NEW |