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

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

Issue 284283002: Domain Reliability: Omit empty, 0-count resources from uploads (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 TEST_F(DomainReliabilityContextTest, ReportUpload) { 192 TEST_F(DomainReliabilityContextTest, ReportUpload) {
193 GURL url("http://example/always_report"); 193 GURL url("http://example/always_report");
194 DomainReliabilityBeacon beacon = MakeBeacon(&time_); 194 DomainReliabilityBeacon beacon = MakeBeacon(&time_);
195 context_.OnBeacon(url, beacon); 195 context_.OnBeacon(url, beacon);
196 196
197 const char* kExpectedReport = "{\"reporter\":\"test-reporter\"," 197 const char* kExpectedReport = "{\"reporter\":\"test-reporter\","
198 "\"resource_reports\":[{\"beacons\":[{\"http_response_code\":200," 198 "\"resource_reports\":[{\"beacons\":[{\"http_response_code\":200,"
199 "\"request_age_ms\":300250,\"request_elapsed_ms\":250,\"server_ip\":" 199 "\"request_age_ms\":300250,\"request_elapsed_ms\":250,\"server_ip\":"
200 "\"127.0.0.1\",\"status\":\"ok\"}],\"failed_requests\":0," 200 "\"127.0.0.1\",\"status\":\"ok\"}],\"failed_requests\":0,"
201 "\"resource_name\":\"always_report\",\"successful_requests\":1}," 201 "\"resource_name\":\"always_report\",\"successful_requests\":1}]}";
202 "{\"beacons\":[],\"failed_requests\":0,\"resource_name\":"
203 "\"never_report\",\"successful_requests\":0}]}";
204 202
205 time_.Advance(max_delay()); 203 time_.Advance(max_delay());
206 EXPECT_TRUE(upload_pending()); 204 EXPECT_TRUE(upload_pending());
207 EXPECT_EQ(kExpectedReport, upload_report()); 205 EXPECT_EQ(kExpectedReport, upload_report());
208 EXPECT_EQ(GURL("https://example/upload"), upload_url()); 206 EXPECT_EQ(GURL("https://example/upload"), upload_url());
209 CallUploadCallback(true); 207 CallUploadCallback(true);
210 } 208 }
211 209
212 } // namespace 210 } // namespace
213 } // namespace domain_reliability 211 } // 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