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

Side by Side Diff: components/json_schema/json_schema_validator_unittest_base.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 years, 9 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 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 18 matching lines...) Expand all
29 base::FilePath path; 29 base::FilePath path;
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 JSONFileValueSerializer serializer(path); 39 JSONFileValueDeserializer deserializer(path);
40 base::Value* result = serializer.Deserialize(NULL, &error_message); 40 base::Value* result = deserializer.Deserialize(NULL, &error_message);
41 if (!result) 41 if (!result)
42 ADD_FAILURE() << "Could not parse JSON: " << error_message; 42 ADD_FAILURE() << "Could not parse JSON: " << error_message;
43 return result; 43 return result;
44 } 44 }
45 45
46 base::Value* LoadValue(const std::string& filename, base::Value::Type type) { 46 base::Value* LoadValue(const std::string& filename, base::Value::Type type) {
47 scoped_ptr<base::Value> result(LoadValue(filename)); 47 scoped_ptr<base::Value> result(LoadValue(filename));
48 if (!result.get()) 48 if (!result.get())
49 return NULL; 49 return NULL;
50 if (!result->IsType(type)) { 50 if (!result->IsType(type)) {
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 schema->SetString(schema::kType, schema::kNull); 762 schema->SetString(schema::kType, schema::kNull);
763 ExpectNotValid( 763 ExpectNotValid(
764 TEST_SOURCE, 764 TEST_SOURCE,
765 scoped_ptr<base::Value>(new base::FundamentalValue(false)).get(), 765 scoped_ptr<base::Value>(new base::FundamentalValue(false)).get(),
766 schema.get(), 766 schema.get(),
767 NULL, 767 NULL,
768 std::string(), 768 std::string(),
769 JSONSchemaValidator::FormatErrorMessage( 769 JSONSchemaValidator::FormatErrorMessage(
770 JSONSchemaValidator::kInvalidType, schema::kNull, schema::kBoolean)); 770 JSONSchemaValidator::kInvalidType, schema::kNull, schema::kBoolean));
771 } 771 }
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_storage.cc ('k') | components/omnibox/search_suggestion_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698