| 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 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 RequestInfo request = MakeRequestInfo(); | 127 RequestInfo request = MakeRequestInfo(); |
| 128 request.url = GURL("http://example/"); | 128 request.url = GURL("http://example/"); |
| 129 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET); | 129 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET); |
| 130 request.response_info.headers = nullptr; | 130 request.response_info.headers = nullptr; |
| 131 OnRequestLegComplete(request); | 131 OnRequestLegComplete(request); |
| 132 | 132 |
| 133 EXPECT_EQ(1u, CountQueuedBeacons(context)); | 133 EXPECT_EQ(1u, CountQueuedBeacons(context)); |
| 134 } | 134 } |
| 135 | 135 |
| 136 TEST_F(DomainReliabilityMonitorTest, GoAwayWithPortMigrationDetected) { |
| 137 DomainReliabilityContext* context = CreateAndAddContext(); |
| 138 |
| 139 RequestInfo request = MakeRequestInfo(); |
| 140 request.url = GURL("http://example/"); |
| 141 request.details.quic_port_migration_detected = true; |
| 142 request.response_info.headers = nullptr; |
| 143 OnRequestLegComplete(request); |
| 144 |
| 145 EXPECT_EQ(1u, CountQueuedBeacons(context)); |
| 146 } |
| 147 |
| 136 TEST_F(DomainReliabilityMonitorTest, ServerFailure) { | 148 TEST_F(DomainReliabilityMonitorTest, ServerFailure) { |
| 137 DomainReliabilityContext* context = CreateAndAddContext(); | 149 DomainReliabilityContext* context = CreateAndAddContext(); |
| 138 | 150 |
| 139 RequestInfo request = MakeRequestInfo(); | 151 RequestInfo request = MakeRequestInfo(); |
| 140 request.url = GURL("http://example/"); | 152 request.url = GURL("http://example/"); |
| 141 request.response_info.headers = | 153 request.response_info.headers = |
| 142 MakeHttpResponseHeaders("HTTP/1.1 500 :(\n\n"); | 154 MakeHttpResponseHeaders("HTTP/1.1 500 :(\n\n"); |
| 143 OnRequestLegComplete(request); | 155 OnRequestLegComplete(request); |
| 144 | 156 |
| 145 EXPECT_EQ(1u, CountQueuedBeacons(context)); | 157 EXPECT_EQ(1u, CountQueuedBeacons(context)); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET); | 376 request.status = net::URLRequestStatus::FromError(net::ERR_CONNECTION_RESET); |
| 365 OnRequestLegComplete(request); | 377 OnRequestLegComplete(request); |
| 366 | 378 |
| 367 EXPECT_EQ(1u, CountQueuedBeacons(context1)); | 379 EXPECT_EQ(1u, CountQueuedBeacons(context1)); |
| 368 EXPECT_EQ(0u, CountQueuedBeacons(context2)); | 380 EXPECT_EQ(0u, CountQueuedBeacons(context2)); |
| 369 } | 381 } |
| 370 | 382 |
| 371 } // namespace | 383 } // namespace |
| 372 | 384 |
| 373 } // namespace domain_reliability | 385 } // namespace domain_reliability |
| OLD | NEW |