OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // Utilities to be used in tests of safe_browsing_db/ component. |
| 6 |
| 7 #ifndef COMPONENTS_SAFE_BROWSING_DB_TESTING_UTIL_H_ |
| 8 #define COMPONENTS_SAFE_BROWSING_DB_TESTING_UTIL_H_ |
| 9 |
| 10 #include "components/safe_browsing_db/util.h" |
| 11 |
| 12 #include <ostream> |
| 13 |
| 14 namespace safe_browsing { |
| 15 |
| 16 inline bool operator==(const ThreatMetadata& lhs, const ThreatMetadata& rhs) { |
| 17 return lhs.threat_pattern_type == rhs.threat_pattern_type && |
| 18 lhs.api_permissions == rhs.api_permissions && |
| 19 lhs.population_id == rhs.population_id && |
| 20 lhs.raw_metadata == rhs.raw_metadata; |
| 21 } |
| 22 |
| 23 inline bool operator!=(const ThreatMetadata& lhs, const ThreatMetadata& rhs) { |
| 24 return !(lhs == rhs); |
| 25 } |
| 26 |
| 27 inline std::ostream& operator<<(std::ostream& os, const ThreatMetadata& meta) { |
| 28 os << "{threat_pattern_type=" << static_cast<int>(meta.threat_pattern_type) |
| 29 << ", api_permissions=["; |
| 30 for (auto p : meta.api_permissions) |
| 31 os << p << ","; |
| 32 return os << "], population_id=" << meta.population_id |
| 33 << ", raw_metadata=" << meta.raw_metadata << "}"; |
| 34 } |
| 35 |
| 36 } // namespace safe_browsing |
| 37 |
| 38 #endif // COMPONENTS_SAFE_BROWSING_DB_TESTING_UTIL_H_ |
OLD | NEW |