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 "components/json_schema/json_schema_validator_unittest_base.h" | 5 #include "components/json_schema/json_schema_validator_unittest_base.h" |
6 | 6 |
7 #include <cfloat> | 7 #include <cfloat> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 30 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
31 path = path.AppendASCII("components") | 31 path = path.AppendASCII("components") |
32 .AppendASCII("test") | 32 .AppendASCII("test") |
33 .AppendASCII("data") | 33 .AppendASCII("data") |
34 .AppendASCII("json_schema") | 34 .AppendASCII("json_schema") |
35 .AppendASCII(filename); | 35 .AppendASCII(filename); |
36 EXPECT_TRUE(base::PathExists(path)); | 36 EXPECT_TRUE(base::PathExists(path)); |
37 | 37 |
38 std::string error_message; | 38 std::string error_message; |
39 JSONFileValueDeserializer deserializer(path); | 39 JSONFileValueDeserializer deserializer(path); |
40 base::Value* result = deserializer.Deserialize(NULL, &error_message); | 40 base::Value* result = |
| 41 deserializer.Deserialize(NULL, &error_message).release(); |
41 if (!result) | 42 if (!result) |
42 ADD_FAILURE() << "Could not parse JSON: " << error_message; | 43 ADD_FAILURE() << "Could not parse JSON: " << error_message; |
43 return result; | 44 return result; |
44 } | 45 } |
45 | 46 |
46 base::Value* LoadValue(const std::string& filename, base::Value::Type type) { | 47 base::Value* LoadValue(const std::string& filename, base::Value::Type type) { |
47 scoped_ptr<base::Value> result(LoadValue(filename)); | 48 scoped_ptr<base::Value> result(LoadValue(filename)); |
48 if (!result.get()) | 49 if (!result.get()) |
49 return NULL; | 50 return NULL; |
50 if (!result->IsType(type)) { | 51 if (!result->IsType(type)) { |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 schema->SetString(schema::kType, schema::kNull); | 755 schema->SetString(schema::kType, schema::kNull); |
755 ExpectNotValid( | 756 ExpectNotValid( |
756 TEST_SOURCE, | 757 TEST_SOURCE, |
757 scoped_ptr<base::Value>(new base::FundamentalValue(false)).get(), | 758 scoped_ptr<base::Value>(new base::FundamentalValue(false)).get(), |
758 schema.get(), | 759 schema.get(), |
759 NULL, | 760 NULL, |
760 std::string(), | 761 std::string(), |
761 JSONSchemaValidator::FormatErrorMessage( | 762 JSONSchemaValidator::FormatErrorMessage( |
762 JSONSchemaValidator::kInvalidType, schema::kNull, schema::kBoolean)); | 763 JSONSchemaValidator::kInvalidType, schema::kNull, schema::kBoolean)); |
763 } | 764 } |
OLD | NEW |