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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return true; | 146 return true; |
146 } | 147 } |
147 | 148 |
148 safe_browsing::ThreatSource GetThreatSource() const override { | 149 safe_browsing::ThreatSource GetThreatSource() const override { |
149 return safe_browsing::ThreatSource::LOCAL_PVER3; | 150 return safe_browsing::ThreatSource::LOCAL_PVER3; |
150 } | 151 } |
151 | 152 |
152 private: | 153 private: |
153 ~FakeSafeBrowsingDatabaseManager() override {} | 154 ~FakeSafeBrowsingDatabaseManager() override {} |
154 | 155 |
155 base::hash_map<std::string, SBThreatType> badurls; | 156 std::map<std::string, SBThreatType> badurls; |
156 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); | 157 DISALLOW_COPY_AND_ASSIGN(FakeSafeBrowsingDatabaseManager); |
157 }; | 158 }; |
158 | 159 |
159 // A SafeBrowingUIManager class that allows intercepting malware details. | 160 // A SafeBrowingUIManager class that allows intercepting malware details. |
160 class FakeSafeBrowsingUIManager : public TestSafeBrowsingUIManager { | 161 class FakeSafeBrowsingUIManager : public TestSafeBrowsingUIManager { |
161 public: | 162 public: |
162 FakeSafeBrowsingUIManager() | 163 FakeSafeBrowsingUIManager() |
163 : TestSafeBrowsingUIManager(), | 164 : TestSafeBrowsingUIManager(), |
164 threat_details_done_(false), | 165 threat_details_done_(false), |
165 hit_report_sent_(false) {} | 166 hit_report_sent_(false) {} |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 | 1567 |
1567 INSTANTIATE_TEST_CASE_P( | 1568 INSTANTIATE_TEST_CASE_P( |
1568 SafeBrowsingBlockingPageIDNTestWithThreatType, | 1569 SafeBrowsingBlockingPageIDNTestWithThreatType, |
1569 SafeBrowsingBlockingPageIDNTest, | 1570 SafeBrowsingBlockingPageIDNTest, |
1570 testing::Combine(testing::Values(false, true), | 1571 testing::Combine(testing::Values(false, true), |
1571 testing::Values(SB_THREAT_TYPE_URL_MALWARE, | 1572 testing::Values(SB_THREAT_TYPE_URL_MALWARE, |
1572 SB_THREAT_TYPE_URL_PHISHING, | 1573 SB_THREAT_TYPE_URL_PHISHING, |
1573 SB_THREAT_TYPE_URL_UNWANTED))); | 1574 SB_THREAT_TYPE_URL_UNWANTED))); |
1574 | 1575 |
1575 } // namespace safe_browsing | 1576 } // namespace safe_browsing |
OLD | NEW |