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/invalidation_test_util.h" | 5 #include "components/invalidation/invalidation_test_util.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 *os << " is equal to " << PrintToString(expected_); | 92 *os << " is equal to " << PrintToString(expected_); |
93 } | 93 } |
94 | 94 |
95 void InvalidationEqMatcher::DescribeNegationTo(::std::ostream* os) const { | 95 void InvalidationEqMatcher::DescribeNegationTo(::std::ostream* os) const { |
96 *os << " isn't equal to " << PrintToString(expected_); | 96 *os << " isn't equal to " << PrintToString(expected_); |
97 } | 97 } |
98 | 98 |
99 } // namespace | 99 } // namespace |
100 | 100 |
101 void PrintTo(const AckHandle& ack_handle, ::std::ostream* os) { | 101 void PrintTo(const AckHandle& ack_handle, ::std::ostream* os) { |
102 scoped_ptr<base::Value> value(ack_handle.ToValue()); | |
103 std::string printable_ack_handle; | 102 std::string printable_ack_handle; |
104 base::JSONWriter::Write(value.get(), &printable_ack_handle); | 103 base::JSONWriter::Write(*ack_handle.ToValue(), &printable_ack_handle); |
105 *os << "{ ack_handle: " << printable_ack_handle << " }"; | 104 *os << "{ ack_handle: " << printable_ack_handle << " }"; |
106 } | 105 } |
107 | 106 |
108 Matcher<const AckHandle&> Eq(const AckHandle& expected) { | 107 Matcher<const AckHandle&> Eq(const AckHandle& expected) { |
109 return MakeMatcher(new AckHandleEqMatcher(expected)); | 108 return MakeMatcher(new AckHandleEqMatcher(expected)); |
110 } | 109 } |
111 | 110 |
112 void PrintTo(const Invalidation& inv, ::std::ostream* os) { | 111 void PrintTo(const Invalidation& inv, ::std::ostream* os) { |
113 *os << "{ payload: " << inv.ToString() << " }"; | 112 *os << "{ payload: " << inv.ToString() << " }"; |
114 } | 113 } |
115 | 114 |
116 Matcher<const Invalidation&> Eq(const Invalidation& expected) { | 115 Matcher<const Invalidation&> Eq(const Invalidation& expected) { |
117 return MakeMatcher(new InvalidationEqMatcher(expected)); | 116 return MakeMatcher(new InvalidationEqMatcher(expected)); |
118 } | 117 } |
119 | 118 |
120 } // namespace syncer | 119 } // namespace syncer |
OLD | NEW |