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

Side by Side Diff: base/json/json_value_converter_unittest.cc

Issue 9113075: Fix a potential memory leak bug. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 11 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
« no previous file with comments | « base/json/json_value_converter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "base/json/json_value_converter.h" 5 #include "base/json/json_value_converter.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 " \"ints\": [1, 2]" 186 " \"ints\": [1, 2]"
187 "}\n"; 187 "}\n";
188 188
189 scoped_ptr<Value> value(base::JSONReader::Read(normal_data, false)); 189 scoped_ptr<Value> value(base::JSONReader::Read(normal_data, false));
190 SimpleMessage message; 190 SimpleMessage message;
191 base::JSONValueConverter<SimpleMessage> converter; 191 base::JSONValueConverter<SimpleMessage> converter;
192 EXPECT_FALSE(converter.Convert(*value.get(), &message)); 192 EXPECT_FALSE(converter.Convert(*value.get(), &message));
193 // No check the values as mentioned above. 193 // No check the values as mentioned above.
194 } 194 }
195 195
196 TEST(JSONValueConverterTest, RepeatedValueErrorInTheMiddle) {
197 const char normal_data[] =
198 "{\n"
199 " \"foo\": 1,\n"
200 " \"bar\": \"bar\",\n"
201 " \"baz\": true,\n"
202 " \"simple_enum\": \"baz\","
203 " \"ints\": [1, false]"
204 "}\n";
205
206 scoped_ptr<Value> value(base::JSONReader::Read(normal_data, false));
207 SimpleMessage message;
208 base::JSONValueConverter<SimpleMessage> converter;
209 EXPECT_FALSE(converter.Convert(*value.get(), &message));
210 // No check the values as mentioned above.
211 }
212
196 } // namespace base 213 } // namespace base
OLDNEW
« no previous file with comments | « base/json/json_value_converter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698