| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // This is similar to NavigateAndCommit that is in test_tab_contents, but | 89 // This is similar to NavigateAndCommit that is in test_tab_contents, but |
| 90 // allows us to specify the referrer and page_transition_type. | 90 // allows us to specify the referrer and page_transition_type. |
| 91 void NavigateAndCommit(const GURL& url, | 91 void NavigateAndCommit(const GURL& url, |
| 92 const GURL& referrer, | 92 const GURL& referrer, |
| 93 content::PageTransition type) { | 93 content::PageTransition type) { |
| 94 contents()->GetController().LoadURL( | 94 contents()->GetController().LoadURL( |
| 95 url, content::Referrer(referrer, WebKit::WebReferrerPolicyDefault), | 95 url, content::Referrer(referrer, WebKit::WebReferrerPolicyDefault), |
| 96 type, std::string()); | 96 type, std::string()); |
| 97 | 97 |
| 98 static int page_id = 0; | 98 static int page_id = 0; |
| 99 RenderViewHost* rvh = contents()->pending_rvh(); | 99 content::RenderViewHost* rvh = contents()->pending_rvh(); |
| 100 if (!rvh) { | 100 if (!rvh) { |
| 101 rvh = contents()->GetRenderViewHost(); | 101 rvh = contents()->GetRenderViewHost(); |
| 102 } | 102 } |
| 103 contents()->ProceedWithCrossSiteNavigation(); | 103 contents()->ProceedWithCrossSiteNavigation(); |
| 104 contents()->TestDidNavigateWithReferrer( | 104 contents()->TestDidNavigateWithReferrer( |
| 105 rvh, ++page_id, url, | 105 rvh, ++page_id, url, |
| 106 content::Referrer(referrer, WebKit::WebReferrerPolicyDefault), type); | 106 content::Referrer(referrer, WebKit::WebReferrerPolicyDefault), type); |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool ExtractFeatures(ClientPhishingRequest* request) { | 109 bool ExtractFeatures(ClientPhishingRequest* request) { |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 EXPECT_TRUE(features.count(StringPrintf("%s%s", | 495 EXPECT_TRUE(features.count(StringPrintf("%s%s", |
| 496 features::kSafeBrowsingMaliciousUrl, | 496 features::kSafeBrowsingMaliciousUrl, |
| 497 "http://www.malware.com/"))); | 497 "http://www.malware.com/"))); |
| 498 EXPECT_TRUE(features.count(StringPrintf("%s%s", | 498 EXPECT_TRUE(features.count(StringPrintf("%s%s", |
| 499 features::kSafeBrowsingOriginalUrl, | 499 features::kSafeBrowsingOriginalUrl, |
| 500 "http://www.good.com/"))); | 500 "http://www.good.com/"))); |
| 501 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]); | 501 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]); |
| 502 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]); | 502 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]); |
| 503 } | 503 } |
| 504 } // namespace safe_browsing | 504 } // namespace safe_browsing |
| OLD | NEW |