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

Side by Side Diff: chrome/browser/extensions/extension_notification_observer.cc

Issue 204703002: Rename NOTIFICATION_EXTENSION_UNLOADED to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe upload wont do something bizarre this time Created 6 years, 9 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 | Annotate | Revision Log
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 "chrome/browser/extensions/extension_notification_observer.h" 5 #include "chrome/browser/extensions/extension_notification_observer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 ExtensionNotificationObserver::ExtensionNotificationObserver( 33 ExtensionNotificationObserver::ExtensionNotificationObserver(
34 content::NotificationSource source, 34 content::NotificationSource source,
35 const std::set<std::string>& extension_ids) 35 const std::set<std::string>& extension_ids)
36 : extension_ids_(extension_ids) { 36 : extension_ids_(extension_ids) {
37 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, source); 37 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, source);
38 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, source); 38 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, source);
39 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, source); 39 registrar_.Add(
40 this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, source);
40 } 41 }
41 42
42 ExtensionNotificationObserver::~ExtensionNotificationObserver() {} 43 ExtensionNotificationObserver::~ExtensionNotificationObserver() {}
43 44
44 testing::AssertionResult ExtensionNotificationObserver::CheckNotifications() { 45 testing::AssertionResult ExtensionNotificationObserver::CheckNotifications() {
45 return CheckNotifications(std::vector<chrome::NotificationType>()); 46 return CheckNotifications(std::vector<chrome::NotificationType>());
46 } 47 }
47 48
48 testing::AssertionResult ExtensionNotificationObserver::CheckNotifications( 49 testing::AssertionResult ExtensionNotificationObserver::CheckNotifications(
49 chrome::NotificationType type) { 50 chrome::NotificationType type) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 103 }
103 104
104 case chrome::NOTIFICATION_EXTENSION_LOADED: { 105 case chrome::NOTIFICATION_EXTENSION_LOADED: {
105 const Extension* extension = 106 const Extension* extension =
106 content::Details<const Extension>(details).ptr(); 107 content::Details<const Extension>(details).ptr();
107 if (extension_ids_.count(extension->id())) 108 if (extension_ids_.count(extension->id()))
108 notifications_.push_back(static_cast<chrome::NotificationType>(type)); 109 notifications_.push_back(static_cast<chrome::NotificationType>(type));
109 break; 110 break;
110 } 111 }
111 112
112 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { 113 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
113 UnloadedExtensionInfo* reason = 114 UnloadedExtensionInfo* reason =
114 content::Details<UnloadedExtensionInfo>(details).ptr(); 115 content::Details<UnloadedExtensionInfo>(details).ptr();
115 if (extension_ids_.count(reason->extension->id())) { 116 if (extension_ids_.count(reason->extension->id())) {
116 notifications_.push_back(static_cast<chrome::NotificationType>(type)); 117 notifications_.push_back(static_cast<chrome::NotificationType>(type));
117 // The only way that extensions are unloaded in these tests is 118 // The only way that extensions are unloaded in these tests is
118 // by blacklisting. 119 // by blacklisting.
119 EXPECT_EQ(UnloadedExtensionInfo::REASON_BLACKLIST, 120 EXPECT_EQ(UnloadedExtensionInfo::REASON_BLACKLIST,
120 reason->reason); 121 reason->reason);
121 } 122 }
122 break; 123 break;
123 } 124 }
124 125
125 default: 126 default:
126 NOTREACHED(); 127 NOTREACHED();
127 break; 128 break;
128 } 129 }
129 } 130 }
130 131
131 testing::AssertionResult ExtensionNotificationObserver::CheckNotifications( 132 testing::AssertionResult ExtensionNotificationObserver::CheckNotifications(
132 const std::vector<chrome::NotificationType>& types) { 133 const std::vector<chrome::NotificationType>& types) {
133 testing::AssertionResult result = (notifications_ == types) ? 134 testing::AssertionResult result = (notifications_ == types) ?
134 testing::AssertionSuccess() : 135 testing::AssertionSuccess() :
135 testing::AssertionFailure() << "Expected " << Str(types) << ", " << 136 testing::AssertionFailure() << "Expected " << Str(types) << ", " <<
136 "Got " << Str(notifications_); 137 "Got " << Str(notifications_);
137 notifications_.clear(); 138 notifications_.clear();
138 return result; 139 return result;
139 } 140 }
140 141
141 } // namespace extensions 142 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_keybinding_registry.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698