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

Unified Diff: extensions/browser/extension_registry_unittest.cc

Issue 289073008: Add TriggerOnUninstalled to ExtensionRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comment 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
« no previous file with comments | « extensions/browser/extension_registry_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_registry_unittest.cc
diff --git a/extensions/browser/extension_registry_unittest.cc b/extensions/browser/extension_registry_unittest.cc
index 8281ee0d51457b1f75a4b121163e057509de777a..5566fffa241dfce930da96e366fc76f74b79fd14 100644
--- a/extensions/browser/extension_registry_unittest.cc
+++ b/extensions/browser/extension_registry_unittest.cc
@@ -39,11 +39,13 @@ class TestObserver : public ExtensionRegistryObserver {
loaded_.clear();
unloaded_.clear();
installed_.clear();
+ uninstalled_.clear();
}
const ExtensionList& loaded() { return loaded_; }
const ExtensionList& unloaded() { return unloaded_; }
const ExtensionList& installed() { return installed_; }
+ const ExtensionList& uninstalled() { return uninstalled_; }
private:
virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
@@ -66,9 +68,15 @@ class TestObserver : public ExtensionRegistryObserver {
installed_.push_back(extension);
}
+ virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE {
+ uninstalled_.push_back(extension);
+ }
+
ExtensionList loaded_;
ExtensionList unloaded_;
ExtensionList installed_;
+ ExtensionList uninstalled_;
};
TEST_F(ExtensionRegistryTest, FillAndClearRegistry) {
@@ -251,6 +259,10 @@ TEST_F(ExtensionRegistryTest, Observer) {
EXPECT_TRUE(HasSingleExtension(observer.unloaded(), extension.get()));
observer.Reset();
+ registry.TriggerOnUninstalled(extension);
+ EXPECT_TRUE(observer.installed().empty());
+ EXPECT_TRUE(HasSingleExtension(observer.uninstalled(), extension.get()));
+
registry.RemoveObserver(&observer);
}
« no previous file with comments | « extensions/browser/extension_registry_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698