OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/safe_browsing/browser_feature_extractor.h" | 5 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // This is similar to NavigateAndCommit that is in test_tab_contents, but | 90 // This is similar to NavigateAndCommit that is in test_tab_contents, but |
91 // allows us to specify the referrer and page_transition_type. | 91 // allows us to specify the referrer and page_transition_type. |
92 void NavigateAndCommit(const GURL& url, | 92 void NavigateAndCommit(const GURL& url, |
93 const GURL& referrer, | 93 const GURL& referrer, |
94 content::PageTransition type) { | 94 content::PageTransition type) { |
95 contents()->controller().LoadURL(url, referrer, type, std::string()); | 95 contents()->controller().LoadURL(url, referrer, type, std::string()); |
96 | 96 |
97 static int page_id = 0; | 97 static int page_id = 0; |
98 ViewHostMsg_FrameNavigate_Params params; | 98 ViewHostMsg_FrameNavigate_Params params; |
99 InitNavigateParams(¶ms, ++page_id, url, type); | 99 InitNavigateParams(¶ms, ++page_id, url, type); |
100 params.referrer = referrer; | 100 params.referrer = |
| 101 content::Referrer(referrer, WebKit::WebReferrerPolicyDefault); |
101 | 102 |
102 RenderViewHost* rvh = contents()->pending_rvh(); | 103 RenderViewHost* rvh = contents()->pending_rvh(); |
103 if (!rvh) { | 104 if (!rvh) { |
104 rvh = contents()->render_view_host(); | 105 rvh = contents()->render_view_host(); |
105 } | 106 } |
106 contents()->ProceedWithCrossSiteNavigation(); | 107 contents()->ProceedWithCrossSiteNavigation(); |
107 contents()->TestDidNavigate(rvh, params); | 108 contents()->TestDidNavigate(rvh, params); |
108 } | 109 } |
109 | 110 |
110 bool ExtractFeatures(ClientPhishingRequest* request) { | 111 bool ExtractFeatures(ClientPhishingRequest* request) { |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 EXPECT_TRUE(features.count(StringPrintf("%s%s", | 497 EXPECT_TRUE(features.count(StringPrintf("%s%s", |
497 features::kSafeBrowsingMaliciousUrl, | 498 features::kSafeBrowsingMaliciousUrl, |
498 "http://www.malware.com/"))); | 499 "http://www.malware.com/"))); |
499 EXPECT_TRUE(features.count(StringPrintf("%s%s", | 500 EXPECT_TRUE(features.count(StringPrintf("%s%s", |
500 features::kSafeBrowsingOriginalUrl, | 501 features::kSafeBrowsingOriginalUrl, |
501 "http://www.good.com/"))); | 502 "http://www.good.com/"))); |
502 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]); | 503 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]); |
503 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]); | 504 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]); |
504 } | 505 } |
505 } // namespace safe_browsing | 506 } // namespace safe_browsing |
OLD | NEW |