Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: components/domain_reliability/context_unittest.cc

Issue 290473005: Domain Reliability: Include config_version in uploads (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/domain_reliability/context.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/domain_reliability/context.h" 5 #include "components/domain_reliability/context.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 EXPECT_TRUE(CheckCounts(0, 1, 0)); 151 EXPECT_TRUE(CheckCounts(0, 1, 0));
152 EXPECT_TRUE(CheckNoBeacons(1)); 152 EXPECT_TRUE(CheckNoBeacons(1));
153 EXPECT_TRUE(CheckCounts(1, 0, 0)); 153 EXPECT_TRUE(CheckCounts(1, 0, 0));
154 } 154 }
155 155
156 TEST_F(DomainReliabilityContextTest, ReportUpload) { 156 TEST_F(DomainReliabilityContextTest, ReportUpload) {
157 GURL url("http://example/always_report"); 157 GURL url("http://example/always_report");
158 DomainReliabilityBeacon beacon = MakeBeacon(&time_); 158 DomainReliabilityBeacon beacon = MakeBeacon(&time_);
159 context_.OnBeacon(url, beacon); 159 context_.OnBeacon(url, beacon);
160 160
161 const char* kExpectedReport = "{\"reporter\":\"test-reporter\"," 161 // N.B.: Assumes max_delay is 5 minutes.
162 const char* kExpectedReport = "{\"config_version\":\"1\","
163 "\"reporter\":\"test-reporter\","
162 "\"resource_reports\":[{\"beacons\":[{\"http_response_code\":200," 164 "\"resource_reports\":[{\"beacons\":[{\"http_response_code\":200,"
163 "\"request_age_ms\":300250,\"request_elapsed_ms\":250,\"server_ip\":" 165 "\"request_age_ms\":300250,\"request_elapsed_ms\":250,\"server_ip\":"
164 "\"127.0.0.1\",\"status\":\"ok\"}],\"failed_requests\":0," 166 "\"127.0.0.1\",\"status\":\"ok\"}],\"failed_requests\":0,"
165 "\"resource_name\":\"always_report\",\"successful_requests\":1}]}"; 167 "\"resource_name\":\"always_report\",\"successful_requests\":1}]}";
166 168
167 time_.Advance(max_delay()); 169 time_.Advance(max_delay());
168 EXPECT_TRUE(upload_pending()); 170 EXPECT_TRUE(upload_pending());
169 EXPECT_EQ(kExpectedReport, upload_report()); 171 EXPECT_EQ(kExpectedReport, upload_report());
170 EXPECT_EQ(GURL("https://example/upload"), upload_url()); 172 EXPECT_EQ(GURL("https://example/upload"), upload_url());
171 CallUploadCallback(true); 173 CallUploadCallback(true);
172 } 174 }
173 175
174 } // namespace 176 } // namespace
175 } // namespace domain_reliability 177 } // namespace domain_reliability
OLDNEW
« no previous file with comments | « components/domain_reliability/context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698