| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This test creates a fake safebrowsing service, where we can inject known- | 5 // This test creates a fake safebrowsing service, where we can inject known- |
| 6 // threat urls. It then uses a real browser to go to these urls, and sends | 6 // threat urls. It then uses a real browser to go to these urls, and sends |
| 7 // "goback" or "proceed" commands and verifies they work. | 7 // "goback" or "proceed" commands and verifies they work. |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 const GURL& request_url) const override { | 1014 const GURL& request_url) const override { |
| 1015 const bool is_subresource = testing::get<0>(GetParam()); | 1015 const bool is_subresource = testing::get<0>(GetParam()); |
| 1016 | 1016 |
| 1017 SafeBrowsingService* sb_service = | 1017 SafeBrowsingService* sb_service = |
| 1018 g_browser_process->safe_browsing_service(); | 1018 g_browser_process->safe_browsing_service(); |
| 1019 SafeBrowsingBlockingPage::UnsafeResource resource; | 1019 SafeBrowsingBlockingPage::UnsafeResource resource; |
| 1020 | 1020 |
| 1021 resource.url = request_url; | 1021 resource.url = request_url; |
| 1022 resource.is_subresource = is_subresource; | 1022 resource.is_subresource = is_subresource; |
| 1023 resource.threat_type = testing::get<1>(GetParam()); | 1023 resource.threat_type = testing::get<1>(GetParam()); |
| 1024 resource.render_process_host_id = contents->GetRenderProcessHost()->GetID(); | 1024 resource.web_contents_getter = |
| 1025 resource.render_frame_id = contents->GetMainFrame()->GetRoutingID(); | 1025 SafeBrowsingUIManager::UnsafeResource::GetWebContentsGetter( |
| 1026 contents->GetRenderProcessHost()->GetID(), |
| 1027 contents->GetMainFrame()->GetRoutingID()); |
| 1026 resource.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; | 1028 resource.threat_source = safe_browsing::ThreatSource::LOCAL_PVER3; |
| 1027 | 1029 |
| 1028 return SafeBrowsingBlockingPage::CreateBlockingPage( | 1030 return SafeBrowsingBlockingPage::CreateBlockingPage( |
| 1029 sb_service->ui_manager().get(), contents, | 1031 sb_service->ui_manager().get(), contents, |
| 1030 is_subresource ? GURL("http://mainframe.example.com/") : request_url, | 1032 is_subresource ? GURL("http://mainframe.example.com/") : request_url, |
| 1031 resource); | 1033 resource); |
| 1032 } | 1034 } |
| 1033 }; | 1035 }; |
| 1034 | 1036 |
| 1035 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageIDNTest, | 1037 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageIDNTest, |
| 1036 SafeBrowsingBlockingPageDecodesIDN) { | 1038 SafeBrowsingBlockingPageDecodesIDN) { |
| 1037 EXPECT_TRUE(VerifyIDNDecoded()); | 1039 EXPECT_TRUE(VerifyIDNDecoded()); |
| 1038 } | 1040 } |
| 1039 | 1041 |
| 1040 INSTANTIATE_TEST_CASE_P( | 1042 INSTANTIATE_TEST_CASE_P( |
| 1041 SafeBrowsingBlockingPageIDNTestWithThreatType, | 1043 SafeBrowsingBlockingPageIDNTestWithThreatType, |
| 1042 SafeBrowsingBlockingPageIDNTest, | 1044 SafeBrowsingBlockingPageIDNTest, |
| 1043 testing::Combine(testing::Values(false, true), | 1045 testing::Combine(testing::Values(false, true), |
| 1044 testing::Values(SB_THREAT_TYPE_URL_MALWARE, | 1046 testing::Values(SB_THREAT_TYPE_URL_MALWARE, |
| 1045 SB_THREAT_TYPE_URL_PHISHING, | 1047 SB_THREAT_TYPE_URL_PHISHING, |
| 1046 SB_THREAT_TYPE_URL_UNWANTED))); | 1048 SB_THREAT_TYPE_URL_UNWANTED))); |
| 1047 | 1049 |
| 1048 } // namespace safe_browsing | 1050 } // namespace safe_browsing |
| OLD | NEW |