Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: components/safe_browsing_db/testing_util.h

Issue 2233103002: Move full hash caching logic to v4_get_hash_protocol_manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove more tests from db_manager. Simplify another test. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 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 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 // Utilities to be used in tests of safe_browsing_db/ component. 5 // Utilities to be used in tests of safe_browsing_db/ component.
6 6
7 #ifndef COMPONENTS_SAFE_BROWSING_DB_TESTING_UTIL_H_ 7 #ifndef COMPONENTS_SAFE_BROWSING_DB_TESTING_UTIL_H_
8 #define COMPONENTS_SAFE_BROWSING_DB_TESTING_UTIL_H_ 8 #define COMPONENTS_SAFE_BROWSING_DB_TESTING_UTIL_H_
9 9
10 #include "components/safe_browsing_db/util.h" 10 #include "components/safe_browsing_db/util.h"
11 11
12 #include <ostream> 12 #include <ostream>
13 13
14 namespace safe_browsing { 14 namespace safe_browsing {
15 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 }
21
22 inline bool operator!=(const ThreatMetadata& lhs, const ThreatMetadata& rhs) {
23 return !(lhs == rhs);
24 }
25
26 inline std::ostream& operator<<(std::ostream& os, const ThreatMetadata& meta) { 16 inline std::ostream& operator<<(std::ostream& os, const ThreatMetadata& meta) {
27 os << "{threat_pattern_type=" << static_cast<int>(meta.threat_pattern_type) 17 os << "{threat_pattern_type=" << static_cast<int>(meta.threat_pattern_type)
28 << ", api_permissions=["; 18 << ", api_permissions=[";
29 for (auto p : meta.api_permissions) 19 for (auto p : meta.api_permissions)
30 os << p << ","; 20 os << p << ",";
31 return os << "], population_id=" << meta.population_id; 21 return os << "], population_id=" << meta.population_id << "}";
32 } 22 }
33 23
34 } // namespace safe_browsing 24 } // namespace safe_browsing
35 25
36 #endif // COMPONENTS_SAFE_BROWSING_DB_TESTING_UTIL_H_ 26 #endif // COMPONENTS_SAFE_BROWSING_DB_TESTING_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698