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

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

Issue 1726403006: Switch Safe Browsing's metadata from string to struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix safe_browsing_service_browsertest and update components_tests.gyp Created 4 years, 10 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
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698