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

Unified Diff: net/reporting/reporting_test_util.h

Issue 2891133003: Reporting: Wire ReportingDelegate into ChromeNetworkDelegate (Closed)
Patch Set: Created 3 years, 7 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_delegate.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 6e64870fb73e3b02b72bea8e7570c2b402339389..9343278954de5a4f52937c614b9b8a84ba3d481c 100644
--- a/net/reporting/reporting_test_util.h
+++ b/net/reporting/reporting_test_util.h
@@ -11,6 +11,7 @@
#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"
@@ -76,6 +77,28 @@ class TestReportingUploader : public ReportingUploader {
DISALLOW_COPY_AND_ASSIGN(TestReportingUploader);
};
+class TestReportingDelegate : public ReportingDelegate {
+ public:
+ TestReportingDelegate();
+
+ // ReportingDelegate implementation:
+
+ ~TestReportingDelegate() override;
+
+ bool CanQueueReport(const url::Origin& origin) const override;
+
+ bool CanSendReport(const url::Origin& origin) const override;
+
+ bool CanSetClient(const url::Origin& origin,
+ const GURL& endpoint) const override;
+
+ bool CanUseClient(const url::Origin& origin,
+ const GURL& endpoint) const override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestReportingDelegate);
+};
+
// A test implementation of ReportingContext that uses test versions of
// Clock, TickClock, Timer, and ReportingUploader.
class TestReportingContext : public ReportingContext {
@@ -96,6 +119,9 @@ class TestReportingContext : public ReportingContext {
TestReportingUploader* test_uploader() {
return reinterpret_cast<TestReportingUploader*>(uploader());
}
+ TestReportingDelegate* test_delegate() {
+ return reinterpret_cast<TestReportingDelegate*>(delegate());
+ }
private:
// Owned by the Persister and GarbageCollector, respectively, but referenced
« no previous file with comments | « net/reporting/reporting_delegate.cc ('k') | net/reporting/reporting_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698