| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 redirect_chain.push_back(url); | 85 redirect_chain.push_back(url); |
| 86 SetRedirectChain(redirect_chain, true); | 86 SetRedirectChain(redirect_chain, true); |
| 87 NavigateAndCommit(url, GURL(), content::PAGE_TRANSITION_LINK); | 87 NavigateAndCommit(url, GURL(), content::PAGE_TRANSITION_LINK); |
| 88 } | 88 } |
| 89 | 89 |
| 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( |
| 96 url, content::Referrer(referrer, WebKit::WebReferrerPolicyDefault), |
| 97 type, std::string()); |
| 96 | 98 |
| 97 static int page_id = 0; | 99 static int page_id = 0; |
| 98 ViewHostMsg_FrameNavigate_Params params; | 100 ViewHostMsg_FrameNavigate_Params params; |
| 99 InitNavigateParams(¶ms, ++page_id, url, type); | 101 InitNavigateParams(¶ms, ++page_id, url, type); |
| 100 params.referrer = referrer; | 102 params.referrer = |
| 103 content::Referrer(referrer, WebKit::WebReferrerPolicyDefault); |
| 101 | 104 |
| 102 RenderViewHost* rvh = contents()->pending_rvh(); | 105 RenderViewHost* rvh = contents()->pending_rvh(); |
| 103 if (!rvh) { | 106 if (!rvh) { |
| 104 rvh = contents()->render_view_host(); | 107 rvh = contents()->render_view_host(); |
| 105 } | 108 } |
| 106 contents()->ProceedWithCrossSiteNavigation(); | 109 contents()->ProceedWithCrossSiteNavigation(); |
| 107 contents()->TestDidNavigate(rvh, params); | 110 contents()->TestDidNavigate(rvh, params); |
| 108 } | 111 } |
| 109 | 112 |
| 110 bool ExtractFeatures(ClientPhishingRequest* request) { | 113 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", | 499 EXPECT_TRUE(features.count(StringPrintf("%s%s", |
| 497 features::kSafeBrowsingMaliciousUrl, | 500 features::kSafeBrowsingMaliciousUrl, |
| 498 "http://www.malware.com/"))); | 501 "http://www.malware.com/"))); |
| 499 EXPECT_TRUE(features.count(StringPrintf("%s%s", | 502 EXPECT_TRUE(features.count(StringPrintf("%s%s", |
| 500 features::kSafeBrowsingOriginalUrl, | 503 features::kSafeBrowsingOriginalUrl, |
| 501 "http://www.good.com/"))); | 504 "http://www.good.com/"))); |
| 502 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]); | 505 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]); |
| 503 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]); | 506 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]); |
| 504 } | 507 } |
| 505 } // namespace safe_browsing | 508 } // namespace safe_browsing |
| OLD | NEW |