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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 0, | 89 0, |
90 base::Time::Now(), | 90 base::Time::Now(), |
91 false, | 91 false, |
92 history::SOURCE_BROWSED); | 92 history::SOURCE_BROWSED); |
93 profile_->BlockUntilHistoryProcessesPendingRequests(); | 93 profile_->BlockUntilHistoryProcessesPendingRequests(); |
94 } | 94 } |
95 | 95 |
96 NavigationID CreateNavigationID(int process_id, | 96 NavigationID CreateNavigationID(int process_id, |
97 int render_frame_id, | 97 int render_frame_id, |
98 const std::string& main_frame_url) { | 98 const std::string& main_frame_url) { |
99 NavigationID navigation_id; | 99 NavigationID navigation_id(process_id, render_frame_id, |
100 navigation_id.render_process_id = process_id; | 100 GURL(main_frame_url)); |
101 navigation_id.render_frame_id = render_frame_id; | |
102 navigation_id.main_frame_url = GURL(main_frame_url); | |
103 navigation_id.creation_time = base::TimeTicks::Now(); | 101 navigation_id.creation_time = base::TimeTicks::Now(); |
104 return navigation_id; | 102 return navigation_id; |
105 } | 103 } |
106 | 104 |
107 ResourcePrefetchPredictor::URLRequestSummary CreateURLRequestSummary( | 105 ResourcePrefetchPredictor::URLRequestSummary CreateURLRequestSummary( |
108 int process_id, | 106 int process_id, |
109 int render_frame_id, | 107 int render_frame_id, |
110 const std::string& main_frame_url, | 108 const std::string& main_frame_url, |
111 const std::string& resource_url, | 109 const std::string& resource_url, |
112 content::ResourceType resource_type, | 110 content::ResourceType resource_type, |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 content::RESOURCE_TYPE_PREFETCH, "bogus/mime-type")); | 775 content::RESOURCE_TYPE_PREFETCH, "bogus/mime-type")); |
778 EXPECT_FALSE(ResourcePrefetchPredictor::IsHandledResourceType( | 776 EXPECT_FALSE(ResourcePrefetchPredictor::IsHandledResourceType( |
779 content::RESOURCE_TYPE_PREFETCH, "")); | 777 content::RESOURCE_TYPE_PREFETCH, "")); |
780 EXPECT_TRUE(ResourcePrefetchPredictor::IsHandledResourceType( | 778 EXPECT_TRUE(ResourcePrefetchPredictor::IsHandledResourceType( |
781 content::RESOURCE_TYPE_PREFETCH, "application/font-woff")); | 779 content::RESOURCE_TYPE_PREFETCH, "application/font-woff")); |
782 EXPECT_TRUE(ResourcePrefetchPredictor::IsHandledResourceType( | 780 EXPECT_TRUE(ResourcePrefetchPredictor::IsHandledResourceType( |
783 content::RESOURCE_TYPE_PREFETCH, "font/woff2")); | 781 content::RESOURCE_TYPE_PREFETCH, "font/woff2")); |
784 } | 782 } |
785 | 783 |
786 } // namespace predictors | 784 } // namespace predictors |
OLD | NEW |