OLD | NEW |
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 Loading... |
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 |
OLD | NEW |