| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
| 6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/test/test_simple_task_runner.h" | 9 #include "base/test/test_simple_task_runner.h" |
| 10 #include "components/safe_browsing_db/v4_database.h" | 10 #include "components/safe_browsing_db/v4_database.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 fhi_malware.metadata.population_id = "malware_popid"; | 142 fhi_malware.metadata.population_id = "malware_popid"; |
| 143 | 143 |
| 144 FullHashInfo fhi_api(FullHash("api"), GetChromeUrlApiId(), base::Time::Now()); | 144 FullHashInfo fhi_api(FullHash("api"), GetChromeUrlApiId(), base::Time::Now()); |
| 145 fhi_api.metadata.population_id = "api_popid"; | 145 fhi_api.metadata.population_id = "api_popid"; |
| 146 | 146 |
| 147 std::vector<FullHashInfo> fhis({fhi_malware, fhi_api}); | 147 std::vector<FullHashInfo> fhis({fhi_malware, fhi_api}); |
| 148 | 148 |
| 149 SBThreatType result_threat_type; | 149 SBThreatType result_threat_type; |
| 150 ThreatMetadata metadata; | 150 ThreatMetadata metadata; |
| 151 | 151 |
| 152 V4LocalDatabaseManager::GetSeverestThreatTypeAndMetadata(&result_threat_type, | 152 v4_local_database_manager_->GetSeverestThreatTypeAndMetadata( |
| 153 &metadata, fhis); | 153 &result_threat_type, &metadata, fhis); |
| 154 EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE, result_threat_type); | 154 EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE, result_threat_type); |
| 155 EXPECT_EQ("malware_popid", metadata.population_id); | 155 EXPECT_EQ("malware_popid", metadata.population_id); |
| 156 | 156 |
| 157 // Reversing the list has no effect. | 157 // Reversing the list has no effect. |
| 158 std::reverse(std::begin(fhis), std::end(fhis)); | 158 std::reverse(std::begin(fhis), std::end(fhis)); |
| 159 V4LocalDatabaseManager::GetSeverestThreatTypeAndMetadata(&result_threat_type, | 159 v4_local_database_manager_->GetSeverestThreatTypeAndMetadata( |
| 160 &metadata, fhis); | 160 &result_threat_type, &metadata, fhis); |
| 161 EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE, result_threat_type); | 161 EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE, result_threat_type); |
| 162 EXPECT_EQ("malware_popid", metadata.population_id); | 162 EXPECT_EQ("malware_popid", metadata.population_id); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace safe_browsing | 165 } // namespace safe_browsing |
| OLD | NEW |