| 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/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 | 962 |
| 963 // The page load time will be collected by RPP_HISTOGRAM_MEDIUM_TIMES, which | 963 // The page load time will be collected by RPP_HISTOGRAM_MEDIUM_TIMES, which |
| 964 // has a upper bound of 3 minutes. | 964 // has a upper bound of 3 minutes. |
| 965 base::TimeDelta plt = | 965 base::TimeDelta plt = |
| 966 predictor_->OnNavigationComplete(main_frame.navigation_id); | 966 predictor_->OnNavigationComplete(main_frame.navigation_id); |
| 967 EXPECT_LT(plt, base::TimeDelta::FromSeconds(180)); | 967 EXPECT_LT(plt, base::TimeDelta::FromSeconds(180)); |
| 968 | 968 |
| 969 profile_->BlockUntilHistoryProcessesPendingRequests(); | 969 profile_->BlockUntilHistoryProcessesPendingRequests(); |
| 970 } | 970 } |
| 971 | 971 |
| 972 TEST_F(ResourcePrefetchPredictorTest, HandledResourceTypes) { |
| 973 EXPECT_TRUE(ResourcePrefetchPredictor::IsHandledResourceType( |
| 974 content::RESOURCE_TYPE_STYLESHEET, "bogus/mime-type")); |
| 975 EXPECT_TRUE(ResourcePrefetchPredictor::IsHandledResourceType( |
| 976 content::RESOURCE_TYPE_STYLESHEET, "")); |
| 977 EXPECT_FALSE(ResourcePrefetchPredictor::IsHandledResourceType( |
| 978 content::RESOURCE_TYPE_WORKER, "text/css")); |
| 979 EXPECT_FALSE(ResourcePrefetchPredictor::IsHandledResourceType( |
| 980 content::RESOURCE_TYPE_WORKER, "")); |
| 981 EXPECT_TRUE(ResourcePrefetchPredictor::IsHandledResourceType( |
| 982 content::RESOURCE_TYPE_PREFETCH, "text/css")); |
| 983 EXPECT_FALSE(ResourcePrefetchPredictor::IsHandledResourceType( |
| 984 content::RESOURCE_TYPE_PREFETCH, "bogus/mime-type")); |
| 985 EXPECT_FALSE(ResourcePrefetchPredictor::IsHandledResourceType( |
| 986 content::RESOURCE_TYPE_PREFETCH, "")); |
| 987 EXPECT_TRUE(ResourcePrefetchPredictor::IsHandledResourceType( |
| 988 content::RESOURCE_TYPE_PREFETCH, "application/font-woff")); |
| 989 EXPECT_TRUE(ResourcePrefetchPredictor::IsHandledResourceType( |
| 990 content::RESOURCE_TYPE_PREFETCH, "font/woff2")); |
| 991 } |
| 992 |
| 972 } // namespace predictors | 993 } // namespace predictors |
| OLD | NEW |