| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CONTENT_PUBLIC_TEST_TEST_DOWNLOAD_REQUEST_HANDLER_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_DOWNLOAD_REQUEST_HANDLER_H_ |
| 6 #define CONTENT_PUBLIC_TEST_TEST_DOWNLOAD_REQUEST_HANDLER_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_DOWNLOAD_REQUEST_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // Notes: | 190 // Notes: |
| 191 // | 191 // |
| 192 // * Distinctions about which read requests signal the error is often only | 192 // * Distinctions about which read requests signal the error is often only |
| 193 // important at the //net layer. From //content, it would appear that 100 | 193 // important at the //net layer. From //content, it would appear that 100 |
| 194 // bytes were read and then request failed with ERR_CONNECTION_RESET. | 194 // bytes were read and then request failed with ERR_CONNECTION_RESET. |
| 195 std::queue<InjectedError> injected_errors; | 195 std::queue<InjectedError> injected_errors; |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 // Details about completed requests returned by GetCompletedRequestInfo(). | 198 // Details about completed requests returned by GetCompletedRequestInfo(). |
| 199 struct CompletedRequest { | 199 struct CompletedRequest { |
| 200 CompletedRequest(); |
| 201 CompletedRequest(CompletedRequest&&); |
| 202 ~CompletedRequest(); |
| 203 |
| 200 // Count of bytes read by the client of the URLRequestJob. This counts the | 204 // Count of bytes read by the client of the URLRequestJob. This counts the |
| 201 // number of bytes of the entity that was transferred *after* content | 205 // number of bytes of the entity that was transferred *after* content |
| 202 // decoding is complete. | 206 // decoding is complete. |
| 203 int64_t transferred_byte_count = -1; | 207 int64_t transferred_byte_count = -1; |
| 204 | 208 |
| 205 net::HttpRequestHeaders request_headers; | 209 net::HttpRequestHeaders request_headers; |
| 210 |
| 211 std::string referrer; |
| 212 net::URLRequest::ReferrerPolicy referrer_policy = |
| 213 net::URLRequest::NEVER_CLEAR_REFERRER; |
| 214 |
| 215 GURL first_party_for_cookies; |
| 216 net::URLRequest::FirstPartyURLPolicy first_party_url_policy = |
| 217 net::URLRequest::NEVER_CHANGE_FIRST_PARTY_URL; |
| 218 |
| 219 url::Origin initiator; |
| 220 |
| 221 private: |
| 222 DISALLOW_COPY_AND_ASSIGN(CompletedRequest); |
| 206 }; | 223 }; |
| 207 | 224 |
| 208 using CompletedRequests = std::vector<CompletedRequest>; | 225 using CompletedRequests = std::vector<std::unique_ptr<CompletedRequest>>; |
| 209 | 226 |
| 210 // Registers a request handler at the default URL. Call url() to determine the | 227 // Registers a request handler at the default URL. Call url() to determine the |
| 211 // URL. | 228 // URL. |
| 212 // | 229 // |
| 213 // Notes: | 230 // Notes: |
| 214 // * This constructor is only meant to be used for convenience when the caller | 231 // * This constructor is only meant to be used for convenience when the caller |
| 215 // is not interested in the URL used for interception. The URL used is | 232 // is not interested in the URL used for interception. The URL used is |
| 216 // generated at run time and should not be assumed to be the same across | 233 // generated at run time and should not be assumed to be the same across |
| 217 // different runs of the same test. | 234 // different runs of the same test. |
| 218 // | 235 // |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 class PartialResponseJob; | 315 class PartialResponseJob; |
| 299 | 316 |
| 300 GURL url_; | 317 GURL url_; |
| 301 base::WeakPtr<Interceptor> interceptor_; | 318 base::WeakPtr<Interceptor> interceptor_; |
| 302 DISALLOW_COPY_AND_ASSIGN(TestDownloadRequestHandler); | 319 DISALLOW_COPY_AND_ASSIGN(TestDownloadRequestHandler); |
| 303 }; | 320 }; |
| 304 | 321 |
| 305 } // namespace content | 322 } // namespace content |
| 306 | 323 |
| 307 #endif // CONTENT_PUBLIC_TEST_TEST_DOWNLOAD_REQUEST_HANDLER_H_ | 324 #endif // CONTENT_PUBLIC_TEST_TEST_DOWNLOAD_REQUEST_HANDLER_H_ |
| OLD | NEW |