Network Error Logging: Update payload fields to use underscores

This updates the NEL implementation to match the fields renames from
https://github.com/WICG/network-error-logging/pull/75.

Bug: 748549
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I0545ce6f9bddb46c556e2ba15d16398ee9c3b1fa
Reviewed-on: https://chromium-review.googlesource.com/1104384
Reviewed-by: Matt Menke <mmenke@chromium.org>
Commit-Queue: Douglas Creager <dcreager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568048}
diff --git a/chrome/browser/resources/net_internals/reporting_view.js b/chrome/browser/resources/net_internals/reporting_view.js
index b43a187..9cb5d77 100644
--- a/chrome/browser/resources/net_internals/reporting_view.js
+++ b/chrome/browser/resources/net_internals/reporting_view.js
@@ -164,9 +164,9 @@
     var body = ensureObject_(report.body);
     addTextNode(contentSections.summary, body.type);
     // Only show the status code if it's present and not 0.
-    if (body['status-code'])
+    if (body.status_code)
       addTextNode(
-          contentSections.summary, ' (' + report.body['status-code'] + ')');
+          contentSections.summary, ' (' + report.body.status_code + ')');
 
     addNodeWithText(
         contentSections.detail, 'pre', JSON.stringify(report, null, '  '));
diff --git a/net/network_error_logging/network_error_logging_end_to_end_test.cc b/net/network_error_logging/network_error_logging_end_to_end_test.cc
index 9dcbe9f..0d78e2f 100644
--- a/net/network_error_logging/network_error_logging_end_to_end_test.cc
+++ b/net/network_error_logging/network_error_logging_end_to_end_test.cc
@@ -205,7 +205,7 @@
   ASSERT_TRUE(report_dict->GetDictionary("report", &body_dict));
 
   ExpectDictStringValue("http.response.empty", *body_dict, "type");
-  ExpectDictIntegerValue(0, *body_dict, "status-code");
+  ExpectDictIntegerValue(0, *body_dict, "status_code");
   ExpectDictStringValue(GetFailURL().spec(), *body_dict, "uri");
 }
 
diff --git a/net/network_error_logging/network_error_logging_service.cc b/net/network_error_logging/network_error_logging_service.cc
index c7f6bc9..cb970801 100644
--- a/net/network_error_logging/network_error_logging_service.cc
+++ b/net/network_error_logging/network_error_logging_service.cc
@@ -545,11 +545,11 @@
 const char NetworkErrorLoggingService::kUriKey[] = "uri";
 const char NetworkErrorLoggingService::kReferrerKey[] = "referrer";
 const char NetworkErrorLoggingService::kSamplingFractionKey[] =
-    "sampling-fraction";
-const char NetworkErrorLoggingService::kServerIpKey[] = "server-ip";
+    "sampling_fraction";
+const char NetworkErrorLoggingService::kServerIpKey[] = "server_ip";
 const char NetworkErrorLoggingService::kProtocolKey[] = "protocol";
-const char NetworkErrorLoggingService::kStatusCodeKey[] = "status-code";
-const char NetworkErrorLoggingService::kElapsedTimeKey[] = "elapsed-time";
+const char NetworkErrorLoggingService::kStatusCodeKey[] = "status_code";
+const char NetworkErrorLoggingService::kElapsedTimeKey[] = "elapsed_time";
 const char NetworkErrorLoggingService::kTypeKey[] = "type";
 
 // static
diff --git a/net/network_error_logging/network_error_logging_service_unittest.cc b/net/network_error_logging/network_error_logging_service_unittest.cc
index ec723678..9c4369a 100644
--- a/net/network_error_logging/network_error_logging_service_unittest.cc
+++ b/net/network_error_logging/network_error_logging_service_unittest.cc
@@ -366,7 +366,7 @@
 
 TEST_F(NetworkErrorLoggingServiceTest, SuccessFractionHalf) {
   // Include a different value for failure_fraction to ensure that we copy the
-  // right value into sampling-fraction.
+  // right value into sampling_fraction.
   static const std::string kHeaderSuccessFractionHalf =
       "{\"report_to\":\"group\",\"max_age\":86400,\"success_fraction\":0.5,"
       "\"failure_fraction\":0.25}";
@@ -392,7 +392,7 @@
     const base::DictionaryValue* body;
     ASSERT_TRUE(report.body->GetAsDictionary(&body));
     // Our header includes a different value for failure_fraction, so that this
-    // check verifies that we copy the correct fraction into sampling-fraction.
+    // check verifies that we copy the correct fraction into sampling_fraction.
     ExpectDictDoubleValue(0.5, *body,
                           NetworkErrorLoggingService::kSamplingFractionKey);
   }
@@ -414,7 +414,7 @@
 
 TEST_F(NetworkErrorLoggingServiceTest, FailureFractionHalf) {
   // Include a different value for success_fraction to ensure that we copy the
-  // right value into sampling-fraction.
+  // right value into sampling_fraction.
   static const std::string kHeaderFailureFractionHalf =
       "{\"report_to\":\"group\",\"max_age\":86400,\"failure_fraction\":0.5,"
       "\"success_fraction\":0.25}";