OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/invalidation/object_id_invalidation_map_test_util.h" | 5 #include "components/invalidation/object_id_invalidation_map_test_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 private: | 32 private: |
33 const ObjectIdInvalidationMap expected_; | 33 const ObjectIdInvalidationMap expected_; |
34 | 34 |
35 DISALLOW_COPY_AND_ASSIGN(ObjectIdInvalidationMapEqMatcher); | 35 DISALLOW_COPY_AND_ASSIGN(ObjectIdInvalidationMapEqMatcher); |
36 }; | 36 }; |
37 | 37 |
38 ObjectIdInvalidationMapEqMatcher::ObjectIdInvalidationMapEqMatcher( | 38 ObjectIdInvalidationMapEqMatcher::ObjectIdInvalidationMapEqMatcher( |
39 const ObjectIdInvalidationMap& expected) : expected_(expected) { | 39 const ObjectIdInvalidationMap& expected) : expected_(expected) { |
40 } | 40 } |
41 | 41 |
42 namespace { | |
43 | |
44 struct InvalidationEqPredicate { | 42 struct InvalidationEqPredicate { |
45 InvalidationEqPredicate(const Invalidation& inv1) | 43 InvalidationEqPredicate(const Invalidation& inv1) |
46 : inv1_(inv1) { } | 44 : inv1_(inv1) { } |
47 | 45 |
48 bool operator()(const Invalidation& inv2) { | 46 bool operator()(const Invalidation& inv2) { |
49 return inv1_.Equals(inv2); | 47 return inv1_.Equals(inv2); |
50 } | 48 } |
51 | 49 |
52 const Invalidation& inv1_; | 50 const Invalidation& inv1_; |
53 }; | 51 }; |
54 | 52 |
55 } | |
56 | |
57 bool ObjectIdInvalidationMapEqMatcher::MatchAndExplain( | 53 bool ObjectIdInvalidationMapEqMatcher::MatchAndExplain( |
58 const ObjectIdInvalidationMap& actual, | 54 const ObjectIdInvalidationMap& actual, |
59 MatchResultListener* listener) const { | 55 MatchResultListener* listener) const { |
60 | 56 |
61 std::vector<syncer::Invalidation> expected_invalidations; | 57 std::vector<syncer::Invalidation> expected_invalidations; |
62 std::vector<syncer::Invalidation> actual_invalidations; | 58 std::vector<syncer::Invalidation> actual_invalidations; |
63 | 59 |
64 expected_.GetAllInvalidations(&expected_invalidations); | 60 expected_.GetAllInvalidations(&expected_invalidations); |
65 actual.GetAllInvalidations(&actual_invalidations); | 61 actual.GetAllInvalidations(&actual_invalidations); |
66 | 62 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 115 } |
120 | 116 |
121 } // namespace | 117 } // namespace |
122 | 118 |
123 Matcher<const ObjectIdInvalidationMap&> Eq( | 119 Matcher<const ObjectIdInvalidationMap&> Eq( |
124 const ObjectIdInvalidationMap& expected) { | 120 const ObjectIdInvalidationMap& expected) { |
125 return MakeMatcher(new ObjectIdInvalidationMapEqMatcher(expected)); | 121 return MakeMatcher(new ObjectIdInvalidationMapEqMatcher(expected)); |
126 } | 122 } |
127 | 123 |
128 } // namespace syncer | 124 } // namespace syncer |
OLD | NEW |