Putting `report-to` behind the Reporting API feature flag

This basically ties in the launch of `report-to` to the launch
of the Reporting API.

I2S: https://groups.google.com/a/chromium.org/d/msg/blink-dev/eYCm_qnf9BA/KLkMRkjcBwAJ
Spec: https://w3c.github.io/webappsec-csp/#directive-report-to

Bug: 726634
Change-Id: If5a3891f5cf2eb14fcbb3d0386b5262a6fc39230
Reviewed-on: https://chromium-review.googlesource.com/1221218
Reviewed-by: Mike West <mkwst@chromium.org>
Commit-Queue: Andy Paicu <andypaicu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#591356}
diff --git a/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc b/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc
index a6ab2cbe..30d91ff 100644
--- a/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc
+++ b/third_party/blink/renderer/core/frame/csp/csp_directive_list.cc
@@ -8,6 +8,7 @@
 #include <utility>
 #include <vector>
 
+#include "services/network/public/cpp/features.h"
 #include "third_party/blink/renderer/bindings/core/v8/source_location.h"
 #include "third_party/blink/renderer/core/dom/document.h"
 #include "third_party/blink/renderer/core/dom/space_split_string.h"
@@ -1452,11 +1453,12 @@
   } else if (type ==
              ContentSecurityPolicy::DirectiveType::kTreatAsPublicAddress) {
     TreatAsPublicAddress(name, value);
+  } else if (type == ContentSecurityPolicy::DirectiveType::kReportTo &&
+             base::FeatureList::IsEnabled(network::features::kReporting)) {
+    ParseReportTo(name, value);
   } else if (policy_->ExperimentalFeaturesEnabled()) {
     if (type == ContentSecurityPolicy::DirectiveType::kRequireSRIFor) {
       ParseRequireSRIFor(name, value);
-    } else if (type == ContentSecurityPolicy::DirectiveType::kReportTo) {
-      ParseReportTo(name, value);
     } else if (type == ContentSecurityPolicy::DirectiveType::kTrustedTypes &&
                RuntimeEnabledFeatures::TrustedDOMTypesEnabled()) {
       RequireTrustedTypes(name, value);
diff --git a/third_party/blink/renderer/core/frame/csp/csp_directive_list_test.cc b/third_party/blink/renderer/core/frame/csp/csp_directive_list_test.cc
index 0581db41..3a49b119 100644
--- a/third_party/blink/renderer/core/frame/csp/csp_directive_list_test.cc
+++ b/third_party/blink/renderer/core/frame/csp/csp_directive_list_test.cc
@@ -8,6 +8,8 @@
 #include <string>
 #include <vector>
 
+#include "base/test/scoped_feature_list.h"
+#include "services/network/public/cpp/features.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
 #include "third_party/blink/renderer/core/frame/csp/source_list_directive.h"
@@ -24,6 +26,7 @@
  public:
   CSPDirectiveListTest() : csp(ContentSecurityPolicy::Create()) {}
   void SetUp() override {
+    scoped_feature_list_.InitWithFeatures({network::features::kReporting}, {});
     csp->SetupSelf(
         *SecurityOrigin::CreateFromString("https://example.test/image.png"));
   }
@@ -42,6 +45,7 @@
 
  protected:
   Persistent<ContentSecurityPolicy> csp;
+  base::test::ScopedFeatureList scoped_feature_list_;
 };
 
 TEST_F(CSPDirectiveListTest, Header) {