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

Unified Diff: extensions/browser/extension_registry_unittest.cc

Issue 279073003: Add a function triggering extension installed to ExtensionRegistryObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/extension_registry_unittest.cc
diff --git a/extensions/browser/extension_registry_unittest.cc b/extensions/browser/extension_registry_unittest.cc
index f212f6c85c9cb8e8bf77378020c85e0d81fdbb15..655b8c42d9a20b85ef388d2c0fe1d32502c0735e 100644
--- a/extensions/browser/extension_registry_unittest.cc
+++ b/extensions/browser/extension_registry_unittest.cc
@@ -37,10 +37,12 @@ class TestObserver : public ExtensionRegistryObserver {
void Reset() {
loaded_.clear();
unloaded_.clear();
+ installed_.clear();
}
const ExtensionList& loaded() { return loaded_; }
const ExtensionList& unloaded() { return unloaded_; }
+ const ExtensionList& installed() { return installed_; }
private:
virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
@@ -55,8 +57,17 @@ class TestObserver : public ExtensionRegistryObserver {
unloaded_.push_back(extension);
}
+ virtual void OnExtensionWillBeInstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ bool is_update,
+ const std::string& old_name) OVERRIDE {
+ installed_.push_back(extension);
+ }
+
ExtensionList loaded_;
ExtensionList unloaded_;
+ ExtensionList installed_;
};
TEST_F(ExtensionRegistryTest, FillAndClearRegistry) {
@@ -215,10 +226,14 @@ TEST_F(ExtensionRegistryTest, Observer) {
EXPECT_TRUE(observer.loaded().empty());
EXPECT_TRUE(observer.unloaded().empty());
+ EXPECT_TRUE(observer.installed().empty());
scoped_refptr<const Extension> extension =
test_util::CreateExtensionWithID("id");
+ registry.TriggerOnWillBeInstalled(extension, false, "foo");
not at google - send to devlin 2014/05/21 16:33:36 there shouldn't be an old-name here because upgrad
limasdf 2014/05/21 21:40:46 Done.
+ EXPECT_TRUE(HasSingleExtension(observer.installed(), extension.get()));
+
registry.AddEnabled(extension);
registry.TriggerOnLoaded(extension);
not at google - send to devlin 2014/05/21 16:33:36 please also trigger an Installed here with "true".
limasdf 2014/05/21 21:40:46 Done. "true" with non-empty extension name.
« extensions/browser/extension_registry.cc ('K') | « extensions/browser/extension_registry_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698