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

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

Issue 166233006: Fix for CountingPolicyTest.RemoveActions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added fullstream_ui_policy_unittest Created 6 years, 10 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 | « chrome/browser/extensions/activity_log/counting_policy_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f65b7a248554fa34b71c88008751fdcb6f36c8c8..835c2a1cc66c2309299b2bebac8e529ff44480f2 100644
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
@@ -229,9 +229,19 @@ class FullStreamUIPolicyTest : public testing::Test {
const std::vector<int64>& action_ids,
const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker) {
+ // 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(
- "punky1", base::Time::Now(), Action::ACTION_DOM_ACCESS, "lets1");
+ scoped_refptr<Action> action =
+ new Action("punky1",
+ mock_clock->Now() - base::TimeDelta::FromMinutes(40),
+ Action::ACTION_DOM_ACCESS,
+ "lets1");
action->mutable_args()->AppendString("vamoose1");
action->set_page_url(GURL("http://www.google1.com"));
action->set_page_title("Google1");
@@ -241,8 +251,10 @@ class FullStreamUIPolicyTest : public testing::Test {
// database.
policy->ProcessAction(action);
- action = new Action(
- "punky2", base::Time::Now(), Action::ACTION_API_CALL, "lets2");
+ action = new Action("punky2",
+ mock_clock->Now() - base::TimeDelta::FromMinutes(30),
+ Action::ACTION_API_CALL,
+ "lets2");
action->mutable_args()->AppendString("vamoose2");
action->set_page_url(GURL("http://www.google2.com"));
action->set_page_title("Google2");
« no previous file with comments | « chrome/browser/extensions/activity_log/counting_policy_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698