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

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

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add todo about not failed trybot Created 5 years, 2 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 19 matching lines...) Expand all
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
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 }
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_storage.cc ('k') | components/omnibox/browser/search_suggestion_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698