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

Unified Diff: net/reporting/reporting_test_util.cc

Issue 2740833004: Reporting: Implement garbage collector. (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 946e1e0bd5e9044575872b59ab96ef497b2e60d8..f1bfabab703726668323bb7dc66e5eedee85fe1d 100644
--- a/net/reporting/reporting_test_util.cc
+++ b/net/reporting/reporting_test_util.cc
@@ -13,10 +13,12 @@
#include "base/memory/ptr_util.h"
#include "base/test/simple_test_clock.h"
#include "base/test/simple_test_tick_clock.h"
+#include "base/timer/mock_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_garbage_collector.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_uploader.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -119,9 +121,17 @@ TestReportingContext::TestReportingContext(const ReportingPolicy& policy)
base::MakeUnique<TestReportingDelegate>(),
base::MakeUnique<base::SimpleTestClock>(),
base::MakeUnique<base::SimpleTestTickClock>(),
- base::MakeUnique<TestReportingUploader>()) {}
+ base::MakeUnique<TestReportingUploader>()),
+ garbage_collection_timer_(
+ new base::MockTimer(/* retain_user_task= */ false,
+ /* is_repeating= */ false)) {
+ garbage_collector()->SetTimerForTesting(
+ base::WrapUnique(garbage_collection_timer_));
+}
-TestReportingContext::~TestReportingContext() {}
+TestReportingContext::~TestReportingContext() {
+ garbage_collection_timer_ = nullptr;
+}
ReportingTestBase::ReportingTestBase() {
// For tests, disable jitter.
« 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