| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 response_info_(response_info), | 63 response_info_(response_info), |
| 64 mime_type_(mime_type) {} | 64 mime_type_(mime_type) {} |
| 65 | 65 |
| 66 bool GetMimeType(std::string* mime_type) const override { | 66 bool GetMimeType(std::string* mime_type) const override { |
| 67 *mime_type = mime_type_; | 67 *mime_type = mime_type_; |
| 68 return true; | 68 return true; |
| 69 } | 69 } |
| 70 | 70 |
| 71 protected: | 71 protected: |
| 72 void Start() override { NotifyHeadersComplete(); } | 72 void Start() override { NotifyHeadersComplete(); } |
| 73 int GetResponseCode() const override { return 200; } | |
| 74 void GetResponseInfo(net::HttpResponseInfo* info) override { | 73 void GetResponseInfo(net::HttpResponseInfo* info) override { |
| 75 *info = response_info_; | 74 *info = response_info_; |
| 76 } | 75 } |
| 77 | 76 |
| 78 private: | 77 private: |
| 79 net::HttpResponseInfo response_info_; | 78 net::HttpResponseInfo response_info_; |
| 80 std::string mime_type_; | 79 std::string mime_type_; |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 class MockURLRequestJobFactory : public net::URLRequestJobFactory { | 82 class MockURLRequestJobFactory : public net::URLRequestJobFactory { |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 predictor_->RecordMainFrameLoadComplete(main_frame.navigation_id); | 1596 predictor_->RecordMainFrameLoadComplete(main_frame.navigation_id); |
| 1598 profile_->BlockUntilHistoryProcessesPendingRequests(); | 1597 profile_->BlockUntilHistoryProcessesPendingRequests(); |
| 1599 | 1598 |
| 1600 histogram_tester_->ExpectBucketCount( | 1599 histogram_tester_->ExpectBucketCount( |
| 1601 internal::kResourcePrefetchPredictorRecallHistogram, 50, 1); | 1600 internal::kResourcePrefetchPredictorRecallHistogram, 50, 1); |
| 1602 histogram_tester_->ExpectBucketCount( | 1601 histogram_tester_->ExpectBucketCount( |
| 1603 internal::kResourcePrefetchPredictorPrecisionHistogram, 33, 1); | 1602 internal::kResourcePrefetchPredictorPrecisionHistogram, 33, 1); |
| 1604 } | 1603 } |
| 1605 | 1604 |
| 1606 } // namespace predictors | 1605 } // namespace predictors |
| OLD | NEW |