| 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 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 response_info_(response_info), | 64 response_info_(response_info), |
| 65 mime_type_(mime_type) {} | 65 mime_type_(mime_type) {} |
| 66 | 66 |
| 67 bool GetMimeType(std::string* mime_type) const override { | 67 bool GetMimeType(std::string* mime_type) const override { |
| 68 *mime_type = mime_type_; | 68 *mime_type = mime_type_; |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 protected: | 72 protected: |
| 73 void Start() override { NotifyHeadersComplete(); } | 73 void Start() override { NotifyHeadersComplete(); } |
| 74 int GetResponseCode() const override { return 200; } | |
| 75 void GetResponseInfo(net::HttpResponseInfo* info) override { | 74 void GetResponseInfo(net::HttpResponseInfo* info) override { |
| 76 *info = response_info_; | 75 *info = response_info_; |
| 77 } | 76 } |
| 78 | 77 |
| 79 private: | 78 private: |
| 80 net::HttpResponseInfo response_info_; | 79 net::HttpResponseInfo response_info_; |
| 81 std::string mime_type_; | 80 std::string mime_type_; |
| 82 }; | 81 }; |
| 83 | 82 |
| 84 class MockURLRequestJobFactory : public net::URLRequestJobFactory { | 83 class MockURLRequestJobFactory : public net::URLRequestJobFactory { |
| (...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 predictor_->host_table_cache_->insert( | 2011 predictor_->host_table_cache_->insert( |
| 2013 std::make_pair(google.primary_key(), google)); | 2012 std::make_pair(google.primary_key(), google)); |
| 2014 | 2013 |
| 2015 predictor_->StartPrefetching(GURL(main_frame_url), PrefetchOrigin::EXTERNAL); | 2014 predictor_->StartPrefetching(GURL(main_frame_url), PrefetchOrigin::EXTERNAL); |
| 2016 predictor_->StopPrefetching(GURL(main_frame_url)); | 2015 predictor_->StopPrefetching(GURL(main_frame_url)); |
| 2017 histogram_tester_->ExpectTotalCount( | 2016 histogram_tester_->ExpectTotalCount( |
| 2018 internal::kResourcePrefetchPredictorPrefetchingDurationHistogram, 1); | 2017 internal::kResourcePrefetchPredictorPrefetchingDurationHistogram, 1); |
| 2019 } | 2018 } |
| 2020 | 2019 |
| 2021 } // namespace predictors | 2020 } // namespace predictors |
| OLD | NEW |