| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 std::vector<SBThreatType> expected_threats; | 85 std::vector<SBThreatType> expected_threats; |
| 86 // TODO(nparker): Remove ref to LocalSafeBrowsingDatabase by calling | 86 // TODO(nparker): Remove ref to LocalSafeBrowsingDatabase by calling |
| 87 // client->OnCheckBrowseUrlResult(..) directly. | 87 // client->OnCheckBrowseUrlResult(..) directly. |
| 88 expected_threats.push_back(SB_THREAT_TYPE_URL_MALWARE); | 88 expected_threats.push_back(SB_THREAT_TYPE_URL_MALWARE); |
| 89 expected_threats.push_back(SB_THREAT_TYPE_URL_PHISHING); | 89 expected_threats.push_back(SB_THREAT_TYPE_URL_PHISHING); |
| 90 expected_threats.push_back(SB_THREAT_TYPE_URL_UNWANTED); | 90 expected_threats.push_back(SB_THREAT_TYPE_URL_UNWANTED); |
| 91 LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck sb_check( | 91 LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck sb_check( |
| 92 std::vector<GURL>(1, gurl), | 92 std::vector<GURL>(1, gurl), |
| 93 std::vector<SBFullHash>(), | 93 std::vector<SBFullHash>(), |
| 94 client, | 94 client, |
| 95 safe_browsing::MALWARE, | 95 safe_browsing_util::MALWARE, |
| 96 expected_threats); | 96 expected_threats); |
| 97 sb_check.url_results[0] = badurls[gurl.spec()]; | 97 sb_check.url_results[0] = badurls[gurl.spec()]; |
| 98 sb_check.OnSafeBrowsingResult(); | 98 sb_check.OnSafeBrowsingResult(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void SetURLThreatType(const GURL& url, SBThreatType threat_type) { | 101 void SetURLThreatType(const GURL& url, SBThreatType threat_type) { |
| 102 badurls[url.spec()] = threat_type; | 102 badurls[url.spec()] = threat_type; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // These are called when checking URLs, so we implement them. | 105 // These are called when checking URLs, so we implement them. |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageIDNTest, | 1016 IN_PROC_BROWSER_TEST_P(SafeBrowsingBlockingPageIDNTest, |
| 1017 SafeBrowsingBlockingPageDecodesIDN) { | 1017 SafeBrowsingBlockingPageDecodesIDN) { |
| 1018 EXPECT_TRUE(VerifyIDNDecoded()); | 1018 EXPECT_TRUE(VerifyIDNDecoded()); |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 INSTANTIATE_TEST_CASE_P(SafeBrowsingBlockingPageIDNTestWithThreatType, | 1021 INSTANTIATE_TEST_CASE_P(SafeBrowsingBlockingPageIDNTestWithThreatType, |
| 1022 SafeBrowsingBlockingPageIDNTest, | 1022 SafeBrowsingBlockingPageIDNTest, |
| 1023 testing::Values(SB_THREAT_TYPE_URL_MALWARE, | 1023 testing::Values(SB_THREAT_TYPE_URL_MALWARE, |
| 1024 SB_THREAT_TYPE_URL_PHISHING, | 1024 SB_THREAT_TYPE_URL_PHISHING, |
| 1025 SB_THREAT_TYPE_URL_UNWANTED)); | 1025 SB_THREAT_TYPE_URL_UNWANTED)); |
| OLD | NEW |