Commit 210545ea authored by Douglas Creager's avatar Douglas Creager Committed by Commit Bot

Reporting: Include include-subdomains in net log

We weren't including the `include-subdomains` field of each endpoint
group in the data we were handing over to the net-internals page.  (The
net-internals code that reads this field is already there; we just
weren't filling in a value.)

Bug: 829353
Change-Id: Ifdff1d6e0baf802eb7f094571060b93c761936af
Reviewed-on: https://chromium-review.googlesource.com/1019661Reviewed-by: default avatarJulia Tuttle <juliatuttle@chromium.org>
Commit-Queue: Douglas Creager <dcreager@google.com>
Cr-Commit-Position: refs/heads/master@{#555755}
parent e2da2ca0
...@@ -335,11 +335,14 @@ class ReportingCacheImpl : public ReportingCache { ...@@ -335,11 +335,14 @@ class ReportingCacheImpl : public ReportingCache {
std::vector<base::Value> endpoint_list; std::vector<base::Value> endpoint_list;
for (const ReportingClient* client : clients) { for (const ReportingClient* client : clients) {
base::Value endpoint_dict(base::Value::Type::DICTIONARY); base::Value endpoint_dict(base::Value::Type::DICTIONARY);
// Reporting defines the group as a whole to have an expiration time, // Reporting defines the group as a whole to have an expiration time
// not the individual endpoints within the group. // and subdomains flag, not the individual endpoints within the group.
group_dict.SetKey( group_dict.SetKey(
"expires", "expires",
base::Value(NetLog::TickCountToString(client->expires))); base::Value(NetLog::TickCountToString(client->expires)));
group_dict.SetKey("includeSubdomains",
base::Value(client->subdomains ==
ReportingClient::Subdomains::INCLUDE));
endpoint_dict.SetKey("url", base::Value(client->endpoint.spec())); endpoint_dict.SetKey("url", base::Value(client->endpoint.spec()));
endpoint_dict.SetKey("priority", base::Value(client->priority)); endpoint_dict.SetKey("priority", base::Value(client->priority));
endpoint_dict.SetKey("weight", base::Value(client->weight)); endpoint_dict.SetKey("weight", base::Value(client->weight));
......
...@@ -409,7 +409,7 @@ TEST_F(ReportingCacheTest, GetClientsAsValue) { ...@@ -409,7 +409,7 @@ TEST_F(ReportingCacheTest, GetClientsAsValue) {
const base::TimeTicks expires = const base::TimeTicks expires =
base::TimeTicks() + base::TimeDelta::FromDays(7); base::TimeTicks() + base::TimeDelta::FromDays(7);
SetClient(kOrigin1_, kEndpoint1_, false, kGroup1_, expires); SetClient(kOrigin1_, kEndpoint1_, false, kGroup1_, expires);
SetClient(kOrigin2_, kEndpoint2_, false, kGroup1_, expires); SetClient(kOrigin2_, kEndpoint2_, true, kGroup1_, expires);
// Add some reports so that we can test the upload counts. // Add some reports so that we can test the upload counts.
const ReportingReport* report1a = AddAndReturnReport( const ReportingReport* report1a = AddAndReturnReport(
...@@ -433,6 +433,7 @@ TEST_F(ReportingCacheTest, GetClientsAsValue) { ...@@ -433,6 +433,7 @@ TEST_F(ReportingCacheTest, GetClientsAsValue) {
{ {
"name": "group1", "name": "group1",
"expires": "604800000", "expires": "604800000",
"includeSubdomains": false,
"endpoints": [ "endpoints": [
{"url": "https://endpoint1/", "priority": 0, "weight": 1, {"url": "https://endpoint1/", "priority": 0, "weight": 1,
"successful": {"uploads": 1, "reports": 2}, "successful": {"uploads": 1, "reports": 2},
...@@ -447,6 +448,7 @@ TEST_F(ReportingCacheTest, GetClientsAsValue) { ...@@ -447,6 +448,7 @@ TEST_F(ReportingCacheTest, GetClientsAsValue) {
{ {
"name": "group1", "name": "group1",
"expires": "604800000", "expires": "604800000",
"includeSubdomains": true,
"endpoints": [ "endpoints": [
{"url": "https://endpoint2/", "priority": 0, "weight": 1, {"url": "https://endpoint2/", "priority": 0, "weight": 1,
"successful": {"uploads": 0, "reports": 0}, "successful": {"uploads": 0, "reports": 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