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

Side by Side Diff: sync/internal_api/public/base/invalidation_state_test_util.cc

Issue 10837214: Refactor ModelTypePayloadMap and ObjectIdPayloadMap to StateMaps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 #include "sync/internal_api/public/base/invalidation_state_test_util.h"
6
7 #include "base/basictypes.h"
8
9 using ::testing::MakeMatcher;
akalin 2012/08/22 22:24:31 move using lines inside namespace?
dcheng 2012/08/22 22:53:19 Done.
10 using ::testing::MatchResultListener;
11 using ::testing::Matcher;
12 using ::testing::MatcherInterface;
13 using ::testing::PrintToString;
14
15 namespace syncer {
16
17 namespace {
18
19 class InvalidationStateEqMatcher
20 : public MatcherInterface<const InvalidationState&> {
21 public:
22 explicit InvalidationStateEqMatcher(const InvalidationState& expected);
23
24 virtual bool MatchAndExplain(const InvalidationState& actual,
25 MatchResultListener* listener) const;
26 virtual void DescribeTo(::std::ostream* os) const;
27 virtual void DescribeNegationTo(::std::ostream* os) const;
28
29 private:
30 InvalidationState expected_;
31
32 DISALLOW_COPY_AND_ASSIGN(InvalidationStateEqMatcher);
33 };
34
35 InvalidationStateEqMatcher::InvalidationStateEqMatcher(
36 const InvalidationState& expected) : expected_(expected) {
37 }
38
39 bool InvalidationStateEqMatcher::MatchAndExplain(
40 const InvalidationState& actual, MatchResultListener* listener) const {
41 return expected_.payload == actual.payload;
42 }
43
44 void InvalidationStateEqMatcher::DescribeTo(::std::ostream* os) const {
45 *os << " is equal to " << PrintToString(expected_);
46 }
47
48 void InvalidationStateEqMatcher::DescribeNegationTo(::std::ostream* os) const {
49 *os << " isn't equal to " << PrintToString(expected_);
50 }
51
52 } // namespace
53
54 void PrintTo(const InvalidationState& state, ::std::ostream* os) {
55 *os << "{ payload: " << state.payload << "}";
akalin 2012/08/22 22:24:31 space before }
dcheng 2012/08/22 22:53:19 Done.
56 }
57
58 Matcher<const InvalidationState&> Eq(const InvalidationState& expected) {
59 return MakeMatcher(new InvalidationStateEqMatcher(expected));
60 }
61
62 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698