Commit a7c9db23 authored by Douglas Creager's avatar Douglas Creager Committed by Commit Bot

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/1104384Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Douglas Creager <dcreager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568048}
parent 22702c01
...@@ -164,9 +164,9 @@ var ReportingView = (function() { ...@@ -164,9 +164,9 @@ var ReportingView = (function() {
var body = ensureObject_(report.body); var body = ensureObject_(report.body);
addTextNode(contentSections.summary, body.type); addTextNode(contentSections.summary, body.type);
// Only show the status code if it's present and not 0. // Only show the status code if it's present and not 0.
if (body['status-code']) if (body.status_code)
addTextNode( addTextNode(
contentSections.summary, ' (' + report.body['status-code'] + ')'); contentSections.summary, ' (' + report.body.status_code + ')');
addNodeWithText( addNodeWithText(
contentSections.detail, 'pre', JSON.stringify(report, null, ' ')); contentSections.detail, 'pre', JSON.stringify(report, null, ' '));
......
...@@ -205,7 +205,7 @@ TEST_F(NetworkErrorLoggingEndToEndTest, MAYBE_ReportNetworkError) { ...@@ -205,7 +205,7 @@ TEST_F(NetworkErrorLoggingEndToEndTest, MAYBE_ReportNetworkError) {
ASSERT_TRUE(report_dict->GetDictionary("report", &body_dict)); ASSERT_TRUE(report_dict->GetDictionary("report", &body_dict));
ExpectDictStringValue("http.response.empty", *body_dict, "type"); 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"); ExpectDictStringValue(GetFailURL().spec(), *body_dict, "uri");
} }
......
...@@ -545,11 +545,11 @@ const int NetworkErrorLoggingService::kMaxNestedReportDepth = 1; ...@@ -545,11 +545,11 @@ const int NetworkErrorLoggingService::kMaxNestedReportDepth = 1;
const char NetworkErrorLoggingService::kUriKey[] = "uri"; const char NetworkErrorLoggingService::kUriKey[] = "uri";
const char NetworkErrorLoggingService::kReferrerKey[] = "referrer"; const char NetworkErrorLoggingService::kReferrerKey[] = "referrer";
const char NetworkErrorLoggingService::kSamplingFractionKey[] = const char NetworkErrorLoggingService::kSamplingFractionKey[] =
"sampling-fraction"; "sampling_fraction";
const char NetworkErrorLoggingService::kServerIpKey[] = "server-ip"; const char NetworkErrorLoggingService::kServerIpKey[] = "server_ip";
const char NetworkErrorLoggingService::kProtocolKey[] = "protocol"; const char NetworkErrorLoggingService::kProtocolKey[] = "protocol";
const char NetworkErrorLoggingService::kStatusCodeKey[] = "status-code"; const char NetworkErrorLoggingService::kStatusCodeKey[] = "status_code";
const char NetworkErrorLoggingService::kElapsedTimeKey[] = "elapsed-time"; const char NetworkErrorLoggingService::kElapsedTimeKey[] = "elapsed_time";
const char NetworkErrorLoggingService::kTypeKey[] = "type"; const char NetworkErrorLoggingService::kTypeKey[] = "type";
// static // static
......
...@@ -366,7 +366,7 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessFraction0) { ...@@ -366,7 +366,7 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessFraction0) {
TEST_F(NetworkErrorLoggingServiceTest, SuccessFractionHalf) { TEST_F(NetworkErrorLoggingServiceTest, SuccessFractionHalf) {
// Include a different value for failure_fraction to ensure that we copy the // 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 = static const std::string kHeaderSuccessFractionHalf =
"{\"report_to\":\"group\",\"max_age\":86400,\"success_fraction\":0.5," "{\"report_to\":\"group\",\"max_age\":86400,\"success_fraction\":0.5,"
"\"failure_fraction\":0.25}"; "\"failure_fraction\":0.25}";
...@@ -392,7 +392,7 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessFractionHalf) { ...@@ -392,7 +392,7 @@ TEST_F(NetworkErrorLoggingServiceTest, SuccessFractionHalf) {
const base::DictionaryValue* body; const base::DictionaryValue* body;
ASSERT_TRUE(report.body->GetAsDictionary(&body)); ASSERT_TRUE(report.body->GetAsDictionary(&body));
// Our header includes a different value for failure_fraction, so that this // 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, ExpectDictDoubleValue(0.5, *body,
NetworkErrorLoggingService::kSamplingFractionKey); NetworkErrorLoggingService::kSamplingFractionKey);
} }
...@@ -414,7 +414,7 @@ TEST_F(NetworkErrorLoggingServiceTest, FailureFraction0) { ...@@ -414,7 +414,7 @@ TEST_F(NetworkErrorLoggingServiceTest, FailureFraction0) {
TEST_F(NetworkErrorLoggingServiceTest, FailureFractionHalf) { TEST_F(NetworkErrorLoggingServiceTest, FailureFractionHalf) {
// Include a different value for success_fraction to ensure that we copy the // 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 = static const std::string kHeaderFailureFractionHalf =
"{\"report_to\":\"group\",\"max_age\":86400,\"failure_fraction\":0.5," "{\"report_to\":\"group\",\"max_age\":86400,\"failure_fraction\":0.5,"
"\"success_fraction\":0.25}"; "\"success_fraction\":0.25}";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment