| 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_prefetcher.h" | 5 #include "chrome/browser/predictors/resource_prefetcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 prefetcher_->OnAuthRequired(GetInFlightRequest(url), NULL); | 126 prefetcher_->OnAuthRequired(GetInFlightRequest(url), NULL); |
| 127 } | 127 } |
| 128 void OnCertificateRequested(const std::string& url) { | 128 void OnCertificateRequested(const std::string& url) { |
| 129 prefetcher_->OnCertificateRequested(GetInFlightRequest(url), NULL); | 129 prefetcher_->OnCertificateRequested(GetInFlightRequest(url), NULL); |
| 130 } | 130 } |
| 131 void OnSSLCertificateError(const std::string& url) { | 131 void OnSSLCertificateError(const std::string& url) { |
| 132 prefetcher_->OnSSLCertificateError(GetInFlightRequest(url), | 132 prefetcher_->OnSSLCertificateError(GetInFlightRequest(url), |
| 133 net::SSLInfo(), false); | 133 net::SSLInfo(), false); |
| 134 } | 134 } |
| 135 void OnResponse(const std::string& url) { | 135 void OnResponse(const std::string& url) { |
| 136 prefetcher_->OnResponseStarted(GetInFlightRequest(url)); | 136 prefetcher_->OnResponseStarted(GetInFlightRequest(url), net::OK); |
| 137 } | 137 } |
| 138 | 138 |
| 139 base::MessageLoop loop_; | 139 base::MessageLoop loop_; |
| 140 content::TestBrowserThread io_thread_; | 140 content::TestBrowserThread io_thread_; |
| 141 ResourcePrefetchPredictorConfig config_; | 141 ResourcePrefetchPredictorConfig config_; |
| 142 TestResourcePrefetcherDelegate prefetcher_delegate_; | 142 TestResourcePrefetcherDelegate prefetcher_delegate_; |
| 143 std::unique_ptr<TestResourcePrefetcher> prefetcher_; | 143 std::unique_ptr<TestResourcePrefetcher> prefetcher_; |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcherTest); | 146 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcherTest); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // We need to delete requests_ptr here, though it looks to be managed by the | 347 // We need to delete requests_ptr here, though it looks to be managed by the |
| 348 // scoped_ptr requests. The scoped_ptr requests releases itself and the raw | 348 // scoped_ptr requests. The scoped_ptr requests releases itself and the raw |
| 349 // pointer requests_ptr is passed to ResourcePrefetcherFinished(). In the | 349 // pointer requests_ptr is passed to ResourcePrefetcherFinished(). In the |
| 350 // test, ResourcePrefetcherFinished() is a mock function and does not handle | 350 // test, ResourcePrefetcherFinished() is a mock function and does not handle |
| 351 // the raw pointer properly. In the real code, requests_ptr will eventually be | 351 // the raw pointer properly. In the real code, requests_ptr will eventually be |
| 352 // passed to and managed by ResourcePrefetchPredictor::Result::Result. | 352 // passed to and managed by ResourcePrefetchPredictor::Result::Result. |
| 353 delete requests_ptr; | 353 delete requests_ptr; |
| 354 } | 354 } |
| 355 | 355 |
| 356 } // namespace predictors | 356 } // namespace predictors |
| OLD | NEW |