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 = | 102 params.referrer = |
101 content::Referrer(referrer, WebKit::WebReferrerPolicyDefault); | 103 content::Referrer(referrer, WebKit::WebReferrerPolicyDefault); |
102 | 104 |
103 RenderViewHost* rvh = contents()->pending_rvh(); | 105 RenderViewHost* rvh = contents()->pending_rvh(); |
104 if (!rvh) { | 106 if (!rvh) { |
105 rvh = contents()->render_view_host(); | 107 rvh = contents()->render_view_host(); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 EXPECT_TRUE(features.count(StringPrintf("%s%s", | 499 EXPECT_TRUE(features.count(StringPrintf("%s%s", |
498 features::kSafeBrowsingMaliciousUrl, | 500 features::kSafeBrowsingMaliciousUrl, |
499 "http://www.malware.com/"))); | 501 "http://www.malware.com/"))); |
500 EXPECT_TRUE(features.count(StringPrintf("%s%s", | 502 EXPECT_TRUE(features.count(StringPrintf("%s%s", |
501 features::kSafeBrowsingOriginalUrl, | 503 features::kSafeBrowsingOriginalUrl, |
502 "http://www.good.com/"))); | 504 "http://www.good.com/"))); |
503 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]); | 505 EXPECT_DOUBLE_EQ(1.0, features[features::kSafeBrowsingIsSubresource]); |
504 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]); | 506 EXPECT_DOUBLE_EQ(2.0, features[features::kSafeBrowsingThreatType]); |
505 } | 507 } |
506 } // namespace safe_browsing | 508 } // namespace safe_browsing |
OLD | NEW |