| 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> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 extractor_.reset( | 90 extractor_.reset( |
| 91 new BrowserFeatureExtractor(web_contents(), host_.get())); | 91 new BrowserFeatureExtractor(web_contents(), host_.get())); |
| 92 num_pending_ = 0; | 92 num_pending_ = 0; |
| 93 browse_info_.reset(new BrowseInfo); | 93 browse_info_.reset(new BrowseInfo); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void TearDown() override { | 96 void TearDown() override { |
| 97 extractor_.reset(); | 97 extractor_.reset(); |
| 98 host_.reset(); | 98 host_.reset(); |
| 99 db_manager_ = NULL; | 99 db_manager_ = NULL; |
| 100 profile()->DestroyHistoryService(); | |
| 101 ChromeRenderViewHostTestHarness::TearDown(); | 100 ChromeRenderViewHostTestHarness::TearDown(); |
| 102 ASSERT_EQ(0, num_pending_); | 101 ASSERT_EQ(0, num_pending_); |
| 103 } | 102 } |
| 104 | 103 |
| 105 history::HistoryService* history_service() { | 104 history::HistoryService* history_service() { |
| 106 return HistoryServiceFactory::GetForProfile( | 105 return HistoryServiceFactory::GetForProfile( |
| 107 profile(), ServiceAccessType::EXPLICIT_ACCESS); | 106 profile(), ServiceAccessType::EXPLICIT_ACCESS); |
| 108 } | 107 } |
| 109 | 108 |
| 110 void SetRedirectChain(const std::vector<GURL>& redirect_chain, | 109 void SetRedirectChain(const std::vector<GURL>& redirect_chain, |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 // First ip is good but all the others are bad. | 651 // First ip is good but all the others are bad. |
| 653 EXPECT_CALL(*db_manager_, MatchMalwareIP(ip)).WillOnce(Return(i > 0)); | 652 EXPECT_CALL(*db_manager_, MatchMalwareIP(ip)).WillOnce(Return(i > 0)); |
| 654 } | 653 } |
| 655 | 654 |
| 656 ExtractMalwareFeatures(&request); | 655 ExtractMalwareFeatures(&request); |
| 657 // 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. |
| 658 EXPECT_EQ(5, request.bad_ip_url_info_size()); | 657 EXPECT_EQ(5, request.bad_ip_url_info_size()); |
| 659 } | 658 } |
| 660 | 659 |
| 661 } // namespace safe_browsing | 660 } // namespace safe_browsing |
| OLD | NEW |