| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "tools/json_schema_compiler/test/error_generation.h" | 5 #include "tools/json_schema_compiler/test/error_generation.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "tools/json_schema_compiler/test/test_util.h" | 10 #include "tools/json_schema_compiler/test/test_util.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 TEST(JsonSchemaCompilerErrorTest, BadEnumValue) { | 205 TEST(JsonSchemaCompilerErrorTest, BadEnumValue) { |
| 206 { | 206 { |
| 207 scoped_ptr<base::DictionaryValue> value = Dictionary( | 207 scoped_ptr<base::DictionaryValue> value = Dictionary( |
| 208 "enumeration", new base::StringValue("one")); | 208 "enumeration", new base::StringValue("one")); |
| 209 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<HasEnumeration>(*value))); | 209 EXPECT_TRUE(EqualsUtf16("", GetPopulateError<HasEnumeration>(*value))); |
| 210 } | 210 } |
| 211 { | 211 { |
| 212 scoped_ptr<base::DictionaryValue> value = Dictionary( | 212 scoped_ptr<base::DictionaryValue> value = Dictionary( |
| 213 "enumeration", new base::StringValue("bad sauce")); | 213 "enumeration", new base::StringValue("bad sauce")); |
| 214 EXPECT_TRUE(EqualsUtf16("'enumeration': expected \"one\" or \"two\" " | 214 EXPECT_TRUE(EqualsUtf16("'Enumeration': expected \"one\" or \"two\" " |
| 215 "or \"three\", got \"bad sauce\"", | 215 "or \"three\", got \"bad sauce\"", |
| 216 GetPopulateError<HasEnumeration>(*value))); | 216 GetPopulateError<HasEnumeration>(*value))); |
| 217 } | 217 } |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Warn but don't fail out errors | 220 // Warn but don't fail out errors |
| 221 | 221 |
| 222 TEST(JsonSchemaCompilerErrorTest, WarnOnOptionalFailure) { | 222 TEST(JsonSchemaCompilerErrorTest, WarnOnOptionalFailure) { |
| 223 { | 223 { |
| 224 scoped_ptr<base::DictionaryValue> value = Dictionary( | 224 scoped_ptr<base::DictionaryValue> value = Dictionary( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 error)); | 309 error)); |
| 310 EXPECT_EQ(NULL, out.the_array.get()); | 310 EXPECT_EQ(NULL, out.the_array.get()); |
| 311 | 311 |
| 312 EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); | 312 EXPECT_TRUE(ArrayObject::Populate(*value, &out, &error)); |
| 313 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer; " | 313 EXPECT_TRUE(EqualsUtf16("'TheArray': expected list, got integer; " |
| 314 "'TheArray': expected list, got integer", | 314 "'TheArray': expected list, got integer", |
| 315 error)); | 315 error)); |
| 316 EXPECT_EQ(NULL, out.the_array.get()); | 316 EXPECT_EQ(NULL, out.the_array.get()); |
| 317 } | 317 } |
| 318 } | 318 } |
| OLD | NEW |