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

Unified Diff: net/reporting/reporting_test_util.h

Issue 2835923005: Reporting: Remove persistence for now. (Closed)
Patch Set: 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_service_unittest.cc ('k') | net/reporting/reporting_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/reporting/reporting_test_util.h
diff --git a/net/reporting/reporting_test_util.h b/net/reporting/reporting_test_util.h
index 2fa0d46cfa75e6ce839eb4758be26046c267cce7..48b63d9b6204934b3f7fba49f8f235fb116e5693 100644
--- a/net/reporting/reporting_test_util.h
+++ b/net/reporting/reporting_test_util.h
@@ -11,7 +11,6 @@
#include "base/macros.h"
#include "net/reporting/reporting_context.h"
-#include "net/reporting/reporting_delegate.h"
#include "net/reporting/reporting_uploader.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -40,24 +39,6 @@ const ReportingClient* FindClientInCache(const ReportingCache* cache,
const url::Origin& origin,
const GURL& endpoint);
-// A simple implementation of ReportingDelegate that only persists data in RAM.
-class TestReportingDelegate : public ReportingDelegate {
- public:
- TestReportingDelegate();
-
- ~TestReportingDelegate() override;
-
- // ReportingDelegate implementation:
- std::unique_ptr<const base::Value> GetPersistedData() override;
-
- void PersistData(std::unique_ptr<const base::Value> persisted_data) override;
-
- private:
- std::unique_ptr<const base::Value> persisted_data_;
-
- DISALLOW_COPY_AND_ASSIGN(TestReportingDelegate);
-};
-
// A test implementation of ReportingUploader that holds uploads for tests to
// examine and complete with a specified outcome.
class TestReportingUploader : public ReportingUploader {
@@ -95,15 +76,12 @@ class TestReportingUploader : public ReportingUploader {
};
// A test implementation of ReportingContext that uses test versions of
-// ReportingDelegate, Clock, TickClock, and ReportingUploader.
+// Clock, TickClock, Timer, and ReportingUploader.
class TestReportingContext : public ReportingContext {
public:
TestReportingContext(const ReportingPolicy& policy);
~TestReportingContext();
- TestReportingDelegate* test_delegate() {
- return reinterpret_cast<TestReportingDelegate*>(delegate());
- }
base::SimpleTestClock* test_clock() {
return reinterpret_cast<base::SimpleTestClock*>(clock());
}
@@ -111,7 +89,6 @@ class TestReportingContext : public ReportingContext {
return reinterpret_cast<base::SimpleTestTickClock*>(tick_clock());
}
base::MockTimer* test_delivery_timer() { return delivery_timer_; }
- base::MockTimer* test_persistence_timer() { return persistence_timer_; }
base::MockTimer* test_garbage_collection_timer() {
return garbage_collection_timer_;
}
@@ -124,7 +101,6 @@ class TestReportingContext : public ReportingContext {
// here to preserve type:
base::MockTimer* delivery_timer_;
- base::MockTimer* persistence_timer_;
base::MockTimer* garbage_collection_timer_;
DISALLOW_COPY_AND_ASSIGN(TestReportingContext);
@@ -139,8 +115,7 @@ 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.
+ // Simulates an embedder restart, preserving the ReportingPolicy.
//
// Advances the Clock by |delta|, and the TickClock by |delta_ticks|. Both can
// be zero or negative.
@@ -150,15 +125,11 @@ class ReportingTestBase : public ::testing::Test {
const ReportingPolicy& policy() { return context_->policy(); }
- TestReportingDelegate* delegate() { return context_->test_delegate(); }
base::SimpleTestClock* clock() { return context_->test_clock(); }
base::SimpleTestTickClock* tick_clock() {
return context_->test_tick_clock();
}
base::MockTimer* delivery_timer() { return context_->test_delivery_timer(); }
- base::MockTimer* persistence_timer() {
- return context_->test_persistence_timer();
- }
base::MockTimer* garbage_collection_timer() {
return context_->test_garbage_collection_timer();
}
@@ -187,11 +158,9 @@ class ReportingTestBase : public ::testing::Test {
}
private:
- void CreateAndInitializeContext(
- const ReportingPolicy& policy,
- std::unique_ptr<const base::Value> persisted_data,
- base::Time now,
- base::TimeTicks now_ticks);
+ void CreateContext(const ReportingPolicy& policy,
+ base::Time now,
+ base::TimeTicks now_ticks);
std::unique_ptr<TestReportingContext> context_;
« no previous file with comments | « net/reporting/reporting_service_unittest.cc ('k') | net/reporting/reporting_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698