Index: chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc |
diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc |
index 8fa111d2437d1b0d6491d258742c8d218dbe1187..37dec654c5638a54ceb0fcd1da501158b6b89dbb 100644 |
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc |
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc |
@@ -633,6 +633,64 @@ TEST_F(FullStreamUIPolicyTest, RemoveSpecificURLs) { |
policy->Close(); |
} |
+TEST_F(FullStreamUIPolicyTest, RemoveExtensionData) { |
+ FullStreamUIPolicy* policy = new FullStreamUIPolicy(profile_.get()); |
+ |
+ // Use a mock clock to ensure that events are not recorded on the wrong day |
+ // when the test is run close to local midnight. |
+ base::SimpleTestClock* mock_clock = new base::SimpleTestClock(); |
+ mock_clock->SetNow(base::Time::Now().LocalMidnight() + |
+ base::TimeDelta::FromHours(12)); |
+ policy->SetClockForTesting(scoped_ptr<base::Clock>(mock_clock)); |
+ |
+ // Record some actions |
+ scoped_refptr<Action> action = new Action("deleteextensiondata", |
+ mock_clock->Now(), |
+ Action::ACTION_DOM_ACCESS, |
+ "lets"); |
+ action->mutable_args()->AppendString("vamoose"); |
+ action->set_page_title("Google"); |
+ action->set_arg_url(GURL("http://www.google.com")); |
+ policy->ProcessAction(action); |
+ policy->ProcessAction(action); |
+ policy->ProcessAction(action); |
+ |
+ scoped_refptr<Action> action2 = new Action("dontdelete", |
+ mock_clock->Now(), |
+ Action::ACTION_DOM_ACCESS, |
+ "lets"); |
+ action->mutable_args()->AppendString("vamoose"); |
+ action->set_page_title("Google"); |
+ action->set_arg_url(GURL("http://www.google.com")); |
+ policy->ProcessAction(action2); |
+ |
+ policy->Flush(); |
+ policy->RemoveExtensionData("deleteextensiondata"); |
+ |
+ CheckReadFilteredData( |
+ policy, |
+ "deleteextensiondata", |
+ Action::ACTION_ANY, |
+ "", |
+ "", |
+ "", |
+ -1, |
+ base::Bind( |
+ &FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions0)); |
+ |
+ CheckReadFilteredData( |
+ policy, |
+ "dontdelete", |
+ Action::ACTION_ANY, |
+ "", |
+ "", |
+ "", |
+ -1, |
+ base::Bind( |
+ &FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions1)); |
+ policy->Close(); |
+} |
+ |
TEST_F(FullStreamUIPolicyTest, CapReturns) { |
FullStreamUIPolicy* policy = new FullStreamUIPolicy(profile_.get()); |