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

Unified Diff: chrome/browser/extensions/activity_log/activity_log_unittest.cc

Issue 23983014: [Activity Log] when extension is uninstalled, delete data about it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed bug in test Created 7 years, 3 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/extensions/activity_log/activity_log_unittest.cc
diff --git a/chrome/browser/extensions/activity_log/activity_log_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_unittest.cc
index 8414b85416957235e25b26fa3d9f561e87e57cc8..3652d2e97d3502c69dbae01fcf09f383088dc64b 100644
--- a/chrome/browser/extensions/activity_log/activity_log_unittest.cc
+++ b/chrome/browser/extensions/activity_log/activity_log_unittest.cc
@@ -63,7 +63,12 @@ class ActivityLogTest : public ChromeRenderViewHostTestHarness {
ChromeRenderViewHostTestHarness::TearDown();
}
- static void RetrieveActions_LogAndFetchActions(
+ static void RetrieveActions_LogAndFetchActions0(
+ scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ ASSERT_EQ(0, static_cast<int>(i->size()));
+ }
+
+ static void RetrieveActions_LogAndFetchActions2(
scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
ASSERT_EQ(2, static_cast<int>(i->size()));
}
@@ -156,7 +161,7 @@ TEST_F(ActivityLogTest, LogAndFetchActions) {
"",
"",
0,
- base::Bind(ActivityLogTest::RetrieveActions_LogAndFetchActions));
+ base::Bind(ActivityLogTest::RetrieveActions_LogAndFetchActions2));
}
TEST_F(ActivityLogTest, LogPrerender) {
@@ -240,8 +245,45 @@ TEST_F(ActivityLogTest, ArgUrlExtraction) {
"",
"",
"",
- 0,
+ -1,
base::Bind(ActivityLogTest::RetrieveActions_ArgUrlExtraction));
}
+TEST_F(ActivityLogTest, UninstalledExtension) {
+ scoped_refptr<const Extension> extension =
+ ExtensionBuilder()
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "Test extension")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2))
+ .Build();
+
+ ActivityLog* activity_log = ActivityLog::GetInstance(profile());
+ scoped_ptr<base::ListValue> args(new base::ListValue());
+ ASSERT_TRUE(GetDatabaseEnabled());
+
+ // Write some API calls
+ scoped_refptr<Action> action = new Action(extension->id(),
+ base::Time::Now(),
+ Action::ACTION_API_CALL,
+ "tabs.testMethod");
+ activity_log->LogAction(action);
+ action = new Action(extension->id(),
+ base::Time::Now(),
+ Action::ACTION_DOM_ACCESS,
+ "document.write");
+ action->set_page_url(GURL("http://www.google.com"));
+
+ activity_log->OnExtensionUninstalled(extension);
+
+ activity_log->GetFilteredActions(
+ extension->id(),
+ Action::ACTION_ANY,
+ "",
+ "",
+ "",
+ -1,
+ base::Bind(ActivityLogTest::RetrieveActions_LogAndFetchActions0));
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/activity_log/activity_log_policy.h ('k') | chrome/browser/extensions/activity_log/counting_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698