| 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 "chrome/browser/predictors/resource_prefetch_predictor.h" | 5 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 scoped_refptr<net::HttpResponseHeaders> MakeResponseHeaders( | 63 scoped_refptr<net::HttpResponseHeaders> MakeResponseHeaders( |
| 64 const char* headers) { | 64 const char* headers) { |
| 65 return make_scoped_refptr(new net::HttpResponseHeaders( | 65 return make_scoped_refptr(new net::HttpResponseHeaders( |
| 66 net::HttpUtil::AssembleRawHeaders(headers, strlen(headers)))); | 66 net::HttpUtil::AssembleRawHeaders(headers, strlen(headers)))); |
| 67 } | 67 } |
| 68 | 68 |
| 69 class EmptyURLRequestDelegate : public net::URLRequest::Delegate { | 69 class EmptyURLRequestDelegate : public net::URLRequest::Delegate { |
| 70 void OnResponseStarted(net::URLRequest* request) override {} | 70 void OnResponseStarted(net::URLRequest* request, int net_error) override {} |
| 71 void OnReadCompleted(net::URLRequest* request, int bytes_read) override {} | 71 void OnReadCompleted(net::URLRequest* request, int bytes_read) override {} |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 class MockURLRequestJob : public net::URLRequestJob { | 74 class MockURLRequestJob : public net::URLRequestJob { |
| 75 public: | 75 public: |
| 76 MockURLRequestJob(net::URLRequest* request, | 76 MockURLRequestJob(net::URLRequest* request, |
| 77 const net::HttpResponseInfo& response_info, | 77 const net::HttpResponseInfo& response_info, |
| 78 const std::string& mime_type) | 78 const std::string& mime_type) |
| 79 : net::URLRequestJob(request, nullptr), | 79 : net::URLRequestJob(request, nullptr), |
| 80 response_info_(response_info), | 80 response_info_(response_info), |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 url_request_job_factory_.set_response_info(response_info); | 1064 url_request_job_factory_.set_response_info(response_info); |
| 1065 std::unique_ptr<net::URLRequest> request_etag = | 1065 std::unique_ptr<net::URLRequest> request_etag = |
| 1066 CreateURLRequest(GURL("http://www.google.com/cat.png"), net::MEDIUM, | 1066 CreateURLRequest(GURL("http://www.google.com/cat.png"), net::MEDIUM, |
| 1067 content::RESOURCE_TYPE_PREFETCH, 1, 1, true); | 1067 content::RESOURCE_TYPE_PREFETCH, 1, 1, true); |
| 1068 EXPECT_TRUE(URLRequestSummary::SummarizeResponse(*request_etag, &summary)); | 1068 EXPECT_TRUE(URLRequestSummary::SummarizeResponse(*request_etag, &summary)); |
| 1069 EXPECT_TRUE(summary.has_validators); | 1069 EXPECT_TRUE(summary.has_validators); |
| 1070 EXPECT_TRUE(summary.always_revalidate); | 1070 EXPECT_TRUE(summary.always_revalidate); |
| 1071 } | 1071 } |
| 1072 | 1072 |
| 1073 } // namespace predictors | 1073 } // namespace predictors |
| OLD | NEW |