Reporting: Wire ReportingDelegate into ChromeNetworkDelegate
Add, implement, and call some methods in NetworkDelegate to check
whether sites are allowed to store reports and clients.
BUG=704259,676324
Review-Url: https://codereview.chromium.org/2891133003
Cr-Commit-Position: refs/heads/master@{#473917}
diff --git a/net/reporting/reporting_test_util.cc b/net/reporting/reporting_test_util.cc
index 2a7d1e0c..0b8237fb 100644
--- a/net/reporting/reporting_test_util.cc
+++ b/net/reporting/reporting_test_util.cc
@@ -17,6 +17,7 @@
#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"
@@ -103,11 +104,34 @@
url, json, callback, base::Bind(&ErasePendingUpload, &pending_uploads_)));
}
+TestReportingDelegate::TestReportingDelegate() {}
+
+TestReportingDelegate::~TestReportingDelegate() {}
+
+bool TestReportingDelegate::CanQueueReport(const url::Origin& origin) const {
+ return true;
+}
+
+bool TestReportingDelegate::CanSendReport(const url::Origin& origin) const {
+ return true;
+}
+
+bool TestReportingDelegate::CanSetClient(const url::Origin& origin,
+ const GURL& endpoint) const {
+ return true;
+}
+
+bool TestReportingDelegate::CanUseClient(const url::Origin& origin,
+ const GURL& endpoint) const {
+ return true;
+}
+
TestReportingContext::TestReportingContext(const ReportingPolicy& policy)
: ReportingContext(policy,
base::MakeUnique<base::SimpleTestClock>(),
base::MakeUnique<base::SimpleTestTickClock>(),
- base::MakeUnique<TestReportingUploader>()),
+ base::MakeUnique<TestReportingUploader>(),
+ base::MakeUnique<TestReportingDelegate>()),
delivery_timer_(new base::MockTimer(/* retain_user_task= */ false,
/* is_repeating= */ false)),
garbage_collection_timer_(