OLD | NEW |
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 15 matching lines...) Expand all Loading... |
26 DomainReliabilityBeacon beacon; | 26 DomainReliabilityBeacon beacon; |
27 beacon.status = "ok"; | 27 beacon.status = "ok"; |
28 beacon.chrome_error = net::OK; | 28 beacon.chrome_error = net::OK; |
29 beacon.server_ip = "127.0.0.1"; | 29 beacon.server_ip = "127.0.0.1"; |
30 beacon.http_response_code = 200; | 30 beacon.http_response_code = 200; |
31 beacon.elapsed = base::TimeDelta::FromMilliseconds(250); | 31 beacon.elapsed = base::TimeDelta::FromMilliseconds(250); |
32 beacon.start_time = time->NowTicks() - beacon.elapsed; | 32 beacon.start_time = time->NowTicks() - beacon.elapsed; |
33 return beacon; | 33 return beacon; |
34 } | 34 } |
35 | 35 |
36 } // namespace | |
37 | |
38 class DomainReliabilityContextTest : public testing::Test { | 36 class DomainReliabilityContextTest : public testing::Test { |
39 protected: | 37 protected: |
40 DomainReliabilityContextTest() | 38 DomainReliabilityContextTest() |
41 : dispatcher_(&time_), | 39 : dispatcher_(&time_), |
42 params_(CreateParams()), | 40 params_(CreateParams()), |
43 uploader_(base::Bind(&DomainReliabilityContextTest::OnUploadRequest, | 41 uploader_(base::Bind(&DomainReliabilityContextTest::OnUploadRequest, |
44 base::Unretained(this))), | 42 base::Unretained(this))), |
45 context_(&time_, | 43 context_(&time_, |
46 params_, | 44 params_, |
47 "test-reporter", | 45 "test-reporter", |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 "{\"beacons\":[],\"failed_requests\":0,\"resource_name\":" | 200 "{\"beacons\":[],\"failed_requests\":0,\"resource_name\":" |
203 "\"never_report\",\"successful_requests\":0}]}"; | 201 "\"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 |
| 210 } // namespace |
212 } // namespace domain_reliability | 211 } // namespace domain_reliability |
OLD | NEW |