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

Side by Side Diff: components/invalidation/impl/unacked_invalidation_set_test_util.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 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/impl/unacked_invalidation_set_test_util.h" 5 #include "components/invalidation/impl/unacked_invalidation_set_test_util.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 serializer.set_pretty_print(true); 153 serializer.set_pretty_print(true);
154 serializer.Serialize(*value.get()); 154 serializer.Serialize(*value.get());
155 155
156 (*os) << output; 156 (*os) << output;
157 } 157 }
158 158
159 void PrintTo(const UnackedInvalidationsMap& map, ::std::ostream* os) { 159 void PrintTo(const UnackedInvalidationsMap& map, ::std::ostream* os) {
160 std::unique_ptr<base::ListValue> list(new base::ListValue); 160 std::unique_ptr<base::ListValue> list(new base::ListValue);
161 for (UnackedInvalidationsMap::const_iterator it = map.begin(); 161 for (UnackedInvalidationsMap::const_iterator it = map.begin();
162 it != map.end(); ++it) { 162 it != map.end(); ++it) {
163 list->Append(it->second.ToValue().release()); 163 list->Append(it->second.ToValue());
164 } 164 }
165 165
166 std::string output; 166 std::string output;
167 JSONStringValueSerializer serializer(&output); 167 JSONStringValueSerializer serializer(&output);
168 serializer.set_pretty_print(true); 168 serializer.set_pretty_print(true);
169 serializer.Serialize(*list.get()); 169 serializer.Serialize(*list.get());
170 170
171 (*os) << output; 171 (*os) << output;
172 } 172 }
173 173
174 Matcher<const UnackedInvalidationSet&> Eq( 174 Matcher<const UnackedInvalidationSet&> Eq(
175 const UnackedInvalidationSet& expected) { 175 const UnackedInvalidationSet& expected) {
176 return MakeMatcher(new UnackedInvalidationSetEqMatcher(expected)); 176 return MakeMatcher(new UnackedInvalidationSetEqMatcher(expected));
177 } 177 }
178 178
179 Matcher<const UnackedInvalidationsMap&> Eq( 179 Matcher<const UnackedInvalidationsMap&> Eq(
180 const UnackedInvalidationsMap& expected) { 180 const UnackedInvalidationsMap& expected) {
181 return MakeMatcher(new UnackedInvalidationsMapEqMatcher(expected)); 181 return MakeMatcher(new UnackedInvalidationsMapEqMatcher(expected));
182 } 182 }
183 183
184 } // namespace test_util 184 } // namespace test_util
185 185
186 }; 186 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698