| 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/monitor.h" | 5 #include "components/domain_reliability/monitor.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 time_(new MockTime()), | 61 time_(new MockTime()), |
| 62 monitor_("test-reporter", | 62 monitor_("test-reporter", |
| 63 pref_task_runner_, | 63 pref_task_runner_, |
| 64 network_task_runner_, | 64 network_task_runner_, |
| 65 std::unique_ptr<MockableTime>(time_)) { | 65 std::unique_ptr<MockableTime>(time_)) { |
| 66 monitor_.MoveToNetworkThread(); | 66 monitor_.MoveToNetworkThread(); |
| 67 monitor_.InitURLRequestContext(url_request_context_getter_); | 67 monitor_.InitURLRequestContext(url_request_context_getter_); |
| 68 monitor_.SetDiscardUploads(false); | 68 monitor_.SetDiscardUploads(false); |
| 69 } | 69 } |
| 70 | 70 |
| 71 ~DomainReliabilityMonitorTest() override { |
| 72 monitor_.Shutdown(); |
| 73 } |
| 74 |
| 71 static RequestInfo MakeRequestInfo() { | 75 static RequestInfo MakeRequestInfo() { |
| 72 RequestInfo request; | 76 RequestInfo request; |
| 73 request.status = net::URLRequestStatus(); | 77 request.status = net::URLRequestStatus(); |
| 74 request.response_info.socket_address = | 78 request.response_info.socket_address = |
| 75 net::HostPortPair::FromString("12.34.56.78:80"); | 79 net::HostPortPair::FromString("12.34.56.78:80"); |
| 76 request.response_info.headers = MakeHttpResponseHeaders( | 80 request.response_info.headers = MakeHttpResponseHeaders( |
| 77 "HTTP/1.1 200 OK\n\n"); | 81 "HTTP/1.1 200 OK\n\n"); |
| 78 request.response_info.was_cached = false; | 82 request.response_info.was_cached = false; |
| 79 request.response_info.network_accessed = true; | 83 request.response_info.network_accessed = true; |
| 80 request.response_info.was_fetched_via_proxy = false; | 84 request.response_info.was_fetched_via_proxy = false; |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET); | 451 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET); |
| 448 OnRequestLegComplete(request); | 452 OnRequestLegComplete(request); |
| 449 | 453 |
| 450 EXPECT_EQ(1u, CountQueuedBeacons(context1)); | 454 EXPECT_EQ(1u, CountQueuedBeacons(context1)); |
| 451 EXPECT_EQ(0u, CountQueuedBeacons(context2)); | 455 EXPECT_EQ(0u, CountQueuedBeacons(context2)); |
| 452 } | 456 } |
| 453 | 457 |
| 454 } // namespace | 458 } // namespace |
| 455 | 459 |
| 456 } // namespace domain_reliability | 460 } // namespace domain_reliability |
| OLD | NEW |