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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 prefetcher_->OnAuthRequired(GetInFlightRequest(url), NULL); | 118 prefetcher_->OnAuthRequired(GetInFlightRequest(url), NULL); |
119 } | 119 } |
120 void OnCertificateRequested(const std::string& url) { | 120 void OnCertificateRequested(const std::string& url) { |
121 prefetcher_->OnCertificateRequested(GetInFlightRequest(url), NULL); | 121 prefetcher_->OnCertificateRequested(GetInFlightRequest(url), NULL); |
122 } | 122 } |
123 void OnSSLCertificateError(const std::string& url) { | 123 void OnSSLCertificateError(const std::string& url) { |
124 prefetcher_->OnSSLCertificateError(GetInFlightRequest(url), | 124 prefetcher_->OnSSLCertificateError(GetInFlightRequest(url), |
125 net::SSLInfo(), false); | 125 net::SSLInfo(), false); |
126 } | 126 } |
127 void OnResponse(const std::string& url) { | 127 void OnResponse(const std::string& url) { |
128 prefetcher_->OnResponseStarted(GetInFlightRequest(url)); | 128 prefetcher_->OnResponseStarted(GetInFlightRequest(url), net::OK); |
129 } | 129 } |
130 | 130 |
131 base::MessageLoop loop_; | 131 base::MessageLoop loop_; |
132 content::TestBrowserThread io_thread_; | 132 content::TestBrowserThread io_thread_; |
133 ResourcePrefetchPredictorConfig config_; | 133 ResourcePrefetchPredictorConfig config_; |
134 TestResourcePrefetcherDelegate prefetcher_delegate_; | 134 TestResourcePrefetcherDelegate prefetcher_delegate_; |
135 std::unique_ptr<TestResourcePrefetcher> prefetcher_; | 135 std::unique_ptr<TestResourcePrefetcher> prefetcher_; |
136 | 136 |
137 private: | 137 private: |
138 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcherTest); | 138 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcherTest); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 // Expect the final call. | 268 // Expect the final call. |
269 EXPECT_CALL(prefetcher_delegate_, | 269 EXPECT_CALL(prefetcher_delegate_, |
270 ResourcePrefetcherFinished(Eq(prefetcher_.get()))); | 270 ResourcePrefetcherFinished(Eq(prefetcher_.get()))); |
271 | 271 |
272 OnResponse("http://m.google.com/resource1.jpg"); | 272 OnResponse("http://m.google.com/resource1.jpg"); |
273 CheckPrefetcherState(0, 1, 0); | 273 CheckPrefetcherState(0, 1, 0); |
274 } | 274 } |
275 | 275 |
276 } // namespace predictors | 276 } // namespace predictors |
OLD | NEW |