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

Unified Diff: chrome/browser/performance_monitor/performance_monitor_browsertest.cc

Issue 10694056: CPM Extension Uninstall Watching (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 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: chrome/browser/performance_monitor/performance_monitor_browsertest.cc
diff --git a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc
index 47a1ea258b706d1aba7c7e147c51c1282faf2994..24a33cfbaa6e9ade6f138ce1e14b5901d3955e09 100644
--- a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc
+++ b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc
@@ -274,6 +274,40 @@ IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UpdateExtensionEvent) {
ASSERT_EQ(extension_misc::UNLOAD_REASON_UPDATE, unload_reason);
}
+IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UninstallExtensionEvent) {
+ const int kNumEvents = 3;
+ FilePath extension_path;
+ PathService::Get(chrome::DIR_TEST_DATA, &extension_path);
+ extension_path = extension_path.AppendASCII("performance_monitor")
+ .AppendASCII("extensions")
+ .AppendASCII("simple_extension_v1");
+ const Extension* extension = LoadExtension(extension_path);
+
+ std::vector<ExtensionBasicInfo> extension_infos;
+ // There will be three events in all, each pertaining to the same extension:
+ // Extension Install
+ // Extension Disable (Unload)
+ // Extension Uninstall
+ for (int i = 0; i < kNumEvents; ++i)
+ extension_infos.push_back(ExtensionBasicInfo(extension));
+
+ UninstallExtension(extension->id());
+
+ std::vector<int> expected_event_types;
+ expected_event_types.push_back(EVENT_EXTENSION_INSTALL);
+ expected_event_types.push_back(EVENT_EXTENSION_UNLOAD);
+ expected_event_types.push_back(EVENT_EXTENSION_UNINSTALL);
+
+ std::vector<linked_ptr<Event> > events = GetEvents();
+
+ CheckExtensionEvents(expected_event_types, extension_infos, events);
+
+ // There will be an additional field: The unload reason.
+ int unload_reason = -1;
+ ASSERT_TRUE(events[1]->data()->GetInteger("unloadReason", &unload_reason));
+ ASSERT_EQ(extension_misc::UNLOAD_REASON_UNINSTALL, unload_reason);
+}
+
IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, NewVersionEvent) {
const char kOldVersion[] = "0.0";

Powered by Google App Engine
This is Rietveld 408576698