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 #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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "chrome/browser/history/history_service_factory.h" | 17 #include "chrome/browser/history/history_service_factory.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/safe_browsing/browser_features.h" | 19 #include "chrome/browser/safe_browsing/browser_features.h" |
20 #include "chrome/browser/safe_browsing/client_side_detection_host.h" | 20 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
21 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 21 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
22 #include "chrome/browser/safe_browsing/ui_manager.h" | 22 #include "chrome/browser/safe_browsing/ui_manager.h" |
23 #include "chrome/common/safe_browsing/csd.pb.h" | |
24 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 23 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
25 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
26 #include "components/history/core/browser/history_backend.h" | 25 #include "components/history/core/browser/history_backend.h" |
27 #include "components/history/core/browser/history_service.h" | 26 #include "components/history/core/browser/history_service.h" |
| 27 #include "components/safe_browsing/csd.pb.h" |
28 #include "components/safe_browsing_db/database_manager.h" | 28 #include "components/safe_browsing_db/database_manager.h" |
29 #include "components/safe_browsing_db/test_database_manager.h" | 29 #include "components/safe_browsing_db/test_database_manager.h" |
30 #include "content/public/browser/navigation_controller.h" | 30 #include "content/public/browser/navigation_controller.h" |
31 #include "content/public/browser/navigation_entry.h" | 31 #include "content/public/browser/navigation_entry.h" |
32 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
33 #include "content/public/common/referrer.h" | 33 #include "content/public/common/referrer.h" |
34 #include "content/public/test/test_browser_thread.h" | 34 #include "content/public/test/test_browser_thread.h" |
35 #include "content/public/test/web_contents_tester.h" | 35 #include "content/public/test/web_contents_tester.h" |
36 #include "testing/gmock/include/gmock/gmock.h" | 36 #include "testing/gmock/include/gmock/gmock.h" |
37 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 // First ip is good but all the others are bad. | 651 // First ip is good but all the others are bad. |
652 EXPECT_CALL(*db_manager_, MatchMalwareIP(ip)).WillOnce(Return(i > 0)); | 652 EXPECT_CALL(*db_manager_, MatchMalwareIP(ip)).WillOnce(Return(i > 0)); |
653 } | 653 } |
654 | 654 |
655 ExtractMalwareFeatures(&request); | 655 ExtractMalwareFeatures(&request); |
656 // The number of IP matched url we store is capped at 5 IPs per request. | 656 // The number of IP matched url we store is capped at 5 IPs per request. |
657 EXPECT_EQ(5, request.bad_ip_url_info_size()); | 657 EXPECT_EQ(5, request.bad_ip_url_info_size()); |
658 } | 658 } |
659 | 659 |
660 } // namespace safe_browsing | 660 } // namespace safe_browsing |
OLD | NEW |