Commit bbf0d1bc authored by ttuttle@chromium.org's avatar ttuttle@chromium.org

Domain Reliability: Include config_version in uploads

Echo the config's version in uploads based on the config, so the server
can judge what frequency/type of reports to expect.

BUG=356791

Review URL: https://codereview.chromium.org/290473005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271466 0039d316-1c4b-4281-b951-d872f2087c98
parent f1b171b8
...@@ -272,6 +272,7 @@ scoped_ptr<const Value> DomainReliabilityContext::CreateReport( ...@@ -272,6 +272,7 @@ scoped_ptr<const Value> DomainReliabilityContext::CreateReport(
} }
DictionaryValue* report_value = new DictionaryValue(); DictionaryValue* report_value = new DictionaryValue();
report_value->SetString("config_version", config().version);
report_value->SetString("reporter", upload_reporter_string_); report_value->SetString("reporter", upload_reporter_string_);
report_value->Set("resource_reports", resources_value); report_value->Set("resource_reports", resources_value);
......
...@@ -52,7 +52,7 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContext { ...@@ -52,7 +52,7 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContext {
uint32* successful_requests_out, uint32* successful_requests_out,
uint32* failed_requests_out) const; uint32* failed_requests_out) const;
const DomainReliabilityConfig& config() { return *config_.get(); } const DomainReliabilityConfig& config() const { return *config_.get(); }
// Maximum number of beacons queued per context; if more than this many are // Maximum number of beacons queued per context; if more than this many are
// queued; the oldest beacons will be removed. // queued; the oldest beacons will be removed.
......
...@@ -158,7 +158,9 @@ TEST_F(DomainReliabilityContextTest, ReportUpload) { ...@@ -158,7 +158,9 @@ TEST_F(DomainReliabilityContextTest, ReportUpload) {
DomainReliabilityBeacon beacon = MakeBeacon(&time_); DomainReliabilityBeacon beacon = MakeBeacon(&time_);
context_.OnBeacon(url, beacon); context_.OnBeacon(url, beacon);
const char* kExpectedReport = "{\"reporter\":\"test-reporter\"," // N.B.: Assumes max_delay is 5 minutes.
const char* kExpectedReport = "{\"config_version\":\"1\","
"\"reporter\":\"test-reporter\","
"\"resource_reports\":[{\"beacons\":[{\"http_response_code\":200," "\"resource_reports\":[{\"beacons\":[{\"http_response_code\":200,"
"\"request_age_ms\":300250,\"request_elapsed_ms\":250,\"server_ip\":" "\"request_age_ms\":300250,\"request_elapsed_ms\":250,\"server_ip\":"
"\"127.0.0.1\",\"status\":\"ok\"}],\"failed_requests\":0," "\"127.0.0.1\",\"status\":\"ok\"}],\"failed_requests\":0,"
......
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