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 #include <map> |
10 | 11 |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "base/test/histogram_tester.h" | 18 #include "base/test/histogram_tester.h" |
18 #include "base/values.h" | 19 #include "base/values.h" |
19 #include "build/build_config.h" | 20 #include "build/build_config.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 return true; | 150 return true; |
150 } | 151 } |
151 | 152 |
152 safe_browsing::ThreatSource GetThreatSource() const override { | 153 safe_browsing::ThreatSource GetThreatSource() const override { |
153 return safe_browsing::ThreatSource::LOCAL_PVER3; | 154 return safe_browsing::ThreatSource::LOCAL_PVER3; |
154 } | 155 } |
155 | 156 |
156 private: | 157 private: |
157 ~FakeSafeBrowsingDatabaseManager() override {} | 158 ~FakeSafeBrowsingDatabaseManager() override {} |
158 | 159 |
159 base::hash_map<std::string, SBThreatType> badurls; | 160 std::map<std::string, SBThreatType> badurls; |
160 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); | 161 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); |
161 }; | 162 }; |
162 | 163 |
163 // A SafeBrowingUIManager class that allows intercepting malware details. | 164 // A SafeBrowingUIManager class that allows intercepting malware details. |
164 class FakeSafeBrowsingUIManager : public TestSafeBrowsingUIManager { | 165 class FakeSafeBrowsingUIManager : public TestSafeBrowsingUIManager { |
165 public: | 166 public: |
166 FakeSafeBrowsingUIManager() | 167 FakeSafeBrowsingUIManager() |
167 : TestSafeBrowsingUIManager(), | 168 : TestSafeBrowsingUIManager(), |
168 threat_details_done_(false), | 169 threat_details_done_(false), |
169 hit_report_sent_(false) {} | 170 hit_report_sent_(false) {} |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 | 1595 |
1595 INSTANTIATE_TEST_CASE_P( | 1596 INSTANTIATE_TEST_CASE_P( |
1596 SafeBrowsingBlockingPageIDNTestWithThreatType, | 1597 SafeBrowsingBlockingPageIDNTestWithThreatType, |
1597 SafeBrowsingBlockingPageIDNTest, | 1598 SafeBrowsingBlockingPageIDNTest, |
1598 testing::Combine(testing::Values(false, true), | 1599 testing::Combine(testing::Values(false, true), |
1599 testing::Values(SB_THREAT_TYPE_URL_MALWARE, | 1600 testing::Values(SB_THREAT_TYPE_URL_MALWARE, |
1600 SB_THREAT_TYPE_URL_PHISHING, | 1601 SB_THREAT_TYPE_URL_PHISHING, |
1601 SB_THREAT_TYPE_URL_UNWANTED))); | 1602 SB_THREAT_TYPE_URL_UNWANTED))); |
1602 | 1603 |
1603 } // namespace safe_browsing | 1604 } // namespace safe_browsing |
OLD | NEW |