| Index: net/reporting/reporting_test_util.h
|
| diff --git a/net/reporting/reporting_test_util.h b/net/reporting/reporting_test_util.h
|
| index 9aeaa2e28b29b354e7a71ce450155eba15fa90f8..c1a255a251e2d6e08ccae3cfb609b05dd2818e6a 100644
|
| --- a/net/reporting/reporting_test_util.h
|
| +++ b/net/reporting/reporting_test_util.h
|
| @@ -18,6 +18,7 @@
|
| class GURL;
|
|
|
| namespace base {
|
| +class MockTimer;
|
| class SimpleTestClock;
|
| class SimpleTestTickClock;
|
| class Value;
|
| @@ -108,11 +109,14 @@ class TestReportingContext : public ReportingContext {
|
| base::SimpleTestTickClock* test_tick_clock() {
|
| return reinterpret_cast<base::SimpleTestTickClock*>(tick_clock());
|
| }
|
| + base::MockTimer* test_persistence_timer() { return persistence_timer_; }
|
| TestReportingUploader* test_uploader() {
|
| return reinterpret_cast<TestReportingUploader*>(uploader());
|
| }
|
|
|
| private:
|
| + base::MockTimer* persistence_timer_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(TestReportingContext);
|
| };
|
|
|
| @@ -125,6 +129,13 @@ class ReportingTestBase : public ::testing::Test {
|
|
|
| void UsePolicy(const ReportingPolicy& policy);
|
|
|
| + // Simulates an embedder restart, preserving the ReportingPolicy and any data
|
| + // persisted via the TestReportingDelegate, but nothing else.
|
| + //
|
| + // Advances the Clock by |delta|, and the TickClock by |delta_ticks|. Both can
|
| + // be zero or negative.
|
| + void SimulateRestart(base::TimeDelta delta, base::TimeDelta delta_ticks);
|
| +
|
| TestReportingContext* context() { return context_.get(); }
|
|
|
| const ReportingPolicy& policy() { return context_->policy(); }
|
| @@ -134,6 +145,9 @@ class ReportingTestBase : public ::testing::Test {
|
| base::SimpleTestTickClock* tick_clock() {
|
| return context_->test_tick_clock();
|
| }
|
| + base::MockTimer* persistence_timer() {
|
| + return context_->test_persistence_timer();
|
| + }
|
| TestReportingUploader* uploader() { return context_->test_uploader(); }
|
|
|
| ReportingCache* cache() { return context_->cache(); }
|
| @@ -144,11 +158,19 @@ class ReportingTestBase : public ::testing::Test {
|
| return context_->delivery_agent();
|
| }
|
|
|
| + ReportingPersister* persister() { return context_->persister(); }
|
| +
|
| base::TimeTicks yesterday();
|
|
|
| base::TimeTicks tomorrow();
|
|
|
| private:
|
| + void CreateAndInitializeContext(
|
| + const ReportingPolicy& policy,
|
| + std::unique_ptr<const base::Value> persisted_data,
|
| + base::Time now,
|
| + base::TimeTicks now_ticks);
|
| +
|
| std::unique_ptr<TestReportingContext> context_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ReportingTestBase);
|
|
|