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

Unified Diff: net/reporting/reporting_test_util.cc

Issue 2785293003: Reporting: Make DeliveryAgent self-scheduling. (Closed)
Patch Set: rebase Created 3 years, 8 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 | « net/reporting/reporting_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/reporting/reporting_test_util.cc
diff --git a/net/reporting/reporting_test_util.cc b/net/reporting/reporting_test_util.cc
index 8a7dbd06f4d99d0d4714d274f2feedc927c380e0..74d0cb4d6aad69e1ef882bf278cdaa48091ec821 100644
--- a/net/reporting/reporting_test_util.cc
+++ b/net/reporting/reporting_test_util.cc
@@ -14,11 +14,11 @@
#include "base/test/simple_test_clock.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/timer/mock_timer.h"
-#include "base/timer/timer.h"
#include "net/reporting/reporting_cache.h"
#include "net/reporting/reporting_client.h"
#include "net/reporting/reporting_context.h"
#include "net/reporting/reporting_delegate.h"
+#include "net/reporting/reporting_delivery_agent.h"
#include "net/reporting/reporting_garbage_collector.h"
#include "net/reporting/reporting_persister.h"
#include "net/reporting/reporting_policy.h"
@@ -124,6 +124,8 @@ TestReportingContext::TestReportingContext(const ReportingPolicy& policy)
base::MakeUnique<base::SimpleTestClock>(),
base::MakeUnique<base::SimpleTestTickClock>(),
base::MakeUnique<TestReportingUploader>()),
+ delivery_timer_(new base::MockTimer(/* retain_user_task= */ false,
+ /* is_repeating= */ false)),
persistence_timer_(new base::MockTimer(/* retain_user_task= */ false,
/* is_repeating= */ false)),
garbage_collection_timer_(
@@ -132,9 +134,11 @@ TestReportingContext::TestReportingContext(const ReportingPolicy& policy)
persister()->SetTimerForTesting(base::WrapUnique(persistence_timer_));
garbage_collector()->SetTimerForTesting(
base::WrapUnique(garbage_collection_timer_));
+ delivery_agent()->SetTimerForTesting(base::WrapUnique(delivery_timer_));
}
TestReportingContext::~TestReportingContext() {
+ delivery_timer_ = nullptr;
persistence_timer_ = nullptr;
garbage_collection_timer_ = nullptr;
}
@@ -178,6 +182,10 @@ base::TimeTicks ReportingTestBase::yesterday() {
return tick_clock()->NowTicks() - base::TimeDelta::FromDays(1);
}
+base::TimeTicks ReportingTestBase::now() {
+ return tick_clock()->NowTicks();
+}
+
base::TimeTicks ReportingTestBase::tomorrow() {
return tick_clock()->NowTicks() + base::TimeDelta::FromDays(1);
}
« no previous file with comments | « net/reporting/reporting_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698