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

Unified Diff: chrome/common/json_schema_validator_unittest_base.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/json_schema_validator.h ('k') | chrome/renderer/automation/dom_automation_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/json_schema_validator_unittest_base.cc
diff --git a/chrome/common/json_schema_validator_unittest_base.cc b/chrome/common/json_schema_validator_unittest_base.cc
index 5a9112304ffda419f984bb3612a1100709fff461..bb61d8fadaa1555e0bddb9bb1eef4b8e62e840af 100644
--- a/chrome/common/json_schema_validator_unittest_base.cc
+++ b/chrome/common/json_schema_validator_unittest_base.cc
@@ -117,13 +117,13 @@ void JSONSchemaValidatorTestBase::TestStringPattern() {
schema->SetString("pattern", "foo+");
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foo")).get(),
+ scoped_ptr<Value>(base::StringValue::New("foo")).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foooooo")).get(),
+ scoped_ptr<Value>(base::StringValue::New("foooooo")).get(),
schema.get(), NULL);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("bar")).get(),
+ scoped_ptr<Value>(base::StringValue::New("bar")).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kStringPattern, "foo+"));
@@ -133,20 +133,20 @@ void JSONSchemaValidatorTestBase::TestEnum() {
scoped_ptr<DictionaryValue> schema(LoadDictionary("enum_schema.json"));
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foo")).get(),
+ scoped_ptr<Value>(base::StringValue::New("foo")).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(),
+ scoped_ptr<Value>(base::FalseValue()).get(),
schema.get(), NULL);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("42")).get(),
+ scoped_ptr<Value>(base::StringValue::New("42")).get(),
schema.get(), NULL, "", JSONSchemaValidator::kInvalidEnum);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateNullValue()).get(),
+ scoped_ptr<Value>(base::NullValue()).get(),
schema.get(), NULL, "", JSONSchemaValidator::kInvalidEnum);
}
@@ -154,10 +154,10 @@ void JSONSchemaValidatorTestBase::TestChoices() {
scoped_ptr<DictionaryValue> schema(LoadDictionary("choices_schema.json"));
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateNullValue()).get(),
+ scoped_ptr<Value>(base::NullValue()).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(42)).get(),
schema.get(), NULL);
scoped_ptr<DictionaryValue> instance(new DictionaryValue());
@@ -165,7 +165,7 @@ void JSONSchemaValidatorTestBase::TestChoices() {
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foo")).get(),
+ scoped_ptr<Value>(base::StringValue::New("foo")).get(),
schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice);
ExpectNotValid(TEST_SOURCE,
scoped_ptr<Value>(new ListValue()).get(),
@@ -236,7 +236,7 @@ void JSONSchemaValidatorTestBase::TestObject() {
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
instance->Remove("bar", NULL);
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Set("bar", Value::CreateNullValue());
+ instance->Set("bar", base::NullValue());
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL,
"bar", JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "integer", "null"));
@@ -310,12 +310,12 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
ASSERT_TRUE(schema.get());
scoped_ptr<ListValue> instance(new ListValue());
- instance->Append(Value::CreateStringValue("42"));
- instance->Append(Value::CreateIntegerValue(42));
+ instance->Append(base::StringValue::New("42"));
+ instance->Append(base::NumberValue::New(42));
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Append(Value::CreateStringValue("anything"));
+ instance->Append(base::StringValue::New("anything"));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kArrayMaxItems, "2"));
@@ -325,8 +325,8 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1",
JSONSchemaValidator::kArrayItemRequired);
- instance->Set(0, Value::CreateIntegerValue(42));
- instance->Append(Value::CreateIntegerValue(42));
+ instance->Set(0, base::NumberValue::New(42));
+ instance->Append(base::NumberValue::New(42));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "0",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "string", "integer"));
@@ -334,8 +334,8 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
DictionaryValue* additional_properties = new DictionaryValue();
additional_properties->SetString("type", "any");
schema->Set("additionalProperties", additional_properties);
- instance->Set(0, Value::CreateStringValue("42"));
- instance->Append(Value::CreateStringValue("anything"));
+ instance->Set(0, base::StringValue::New("42"));
+ instance->Append(base::StringValue::New("anything"));
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
instance->Set(2, new ListValue());
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
@@ -344,7 +344,7 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "2",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "boolean", "array"));
- instance->Set(2, Value::CreateBooleanValue(false));
+ instance->Set(2, base::FalseValue());
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
ListValue* items_schema = NULL;
@@ -356,9 +356,9 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
// TODO(aa): I think this is inconsistent with the handling of NULL+optional
// for objects.
- instance->Set(0, Value::CreateNullValue());
+ instance->Set(0, base::NullValue());
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Set(0, Value::CreateIntegerValue(42));
+ instance->Set(0, base::NumberValue::New(42));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "0",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "string", "integer"));
@@ -372,14 +372,14 @@ void JSONSchemaValidatorTestBase::TestArrayNonTuple() {
schema->SetInteger("maxItems", 3);
scoped_ptr<ListValue> instance(new ListValue());
- instance->Append(Value::CreateStringValue("x"));
- instance->Append(Value::CreateStringValue("x"));
+ instance->Append(base::StringValue::New("x"));
+ instance->Append(base::StringValue::New("x"));
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Append(Value::CreateStringValue("x"));
+ instance->Append(base::StringValue::New("x"));
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Append(Value::CreateStringValue("x"));
+ instance->Append(base::StringValue::New("x"));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kArrayMaxItems, "3"));
@@ -391,7 +391,7 @@ void JSONSchemaValidatorTestBase::TestArrayNonTuple() {
JSONSchemaValidator::kArrayMinItems, "2"));
instance->Remove(1, NULL);
- instance->Append(Value::CreateIntegerValue(42));
+ instance->Append(base::NumberValue::New(42));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "string", "integer"));
@@ -404,20 +404,20 @@ void JSONSchemaValidatorTestBase::TestString() {
schema->SetInteger("maxLength", 10);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("x")).get(),
+ scoped_ptr<Value>(base::StringValue::New("x")).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("xxxxxxxxxx")).get(),
+ scoped_ptr<Value>(base::StringValue::New("xxxxxxxxxx")).get(),
schema.get(), NULL);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("")).get(),
+ scoped_ptr<Value>(base::StringValue::New("")).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kStringMinLength, "1"));
ExpectNotValid(
TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("xxxxxxxxxxx")).get(),
+ scoped_ptr<Value>(base::StringValue::New("xxxxxxxxxxx")).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kStringMaxLength, "10"));
@@ -432,27 +432,27 @@ void JSONSchemaValidatorTestBase::TestNumber() {
schema->SetInteger("maxDecimal", 2);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(1)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(1)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(50)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(50)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(100)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(100)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(88.88)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(88.88)).get(),
schema.get(), NULL);
ExpectNotValid(
TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(0.5)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(0.5)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kNumberMinimum, "1"));
ExpectNotValid(
TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(100.1)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(100.1)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kNumberMaximum, "100"));
@@ -460,45 +460,45 @@ void JSONSchemaValidatorTestBase::TestNumber() {
void JSONSchemaValidatorTestBase::TestTypeClassifier() {
EXPECT_EQ("boolean", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateBooleanValue(true)).get()));
+ scoped_ptr<Value>(base::TrueValue()).get()));
EXPECT_EQ("boolean", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateBooleanValue(false)).get()));
+ scoped_ptr<Value>(base::FalseValue()).get()));
// It doesn't matter whether the C++ type is 'integer' or 'real'. If the
// number is integral and within the representable range of integers in
// double, it's classified as 'integer'.
EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get()));
+ scoped_ptr<Value>(base::NumberValue::New(42)).get()));
EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateIntegerValue(0)).get()));
+ scoped_ptr<Value>(base::NumberValue::New(0)).get()));
EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateDoubleValue(42)).get()));
+ scoped_ptr<Value>(base::NumberValue::New(42)).get()));
EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType(
scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get()));
+ base::NumberValue::New(pow(2.0, DBL_MANT_DIG))).get()));
EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType(
scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get()));
+ base::NumberValue::New(pow(-2.0, DBL_MANT_DIG))).get()));
// "number" is only used for non-integral numbers, or numbers beyond what
// double can accurately represent.
EXPECT_EQ("number", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get()));
+ scoped_ptr<Value>(base::NumberValue::New(88.8)).get()));
EXPECT_EQ("number", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateDoubleValue(
+ scoped_ptr<Value>(base::NumberValue::New(
pow(2.0, DBL_MANT_DIG) * 2)).get()));
EXPECT_EQ("number", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateDoubleValue(
+ scoped_ptr<Value>(base::NumberValue::New(
pow(-2.0, DBL_MANT_DIG) * 2)).get()));
EXPECT_EQ("string", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateStringValue("foo")).get()));
+ scoped_ptr<Value>(base::StringValue::New("foo")).get()));
EXPECT_EQ("array", JSONSchemaValidator::GetJSONSchemaType(
scoped_ptr<Value>(new ListValue()).get()));
EXPECT_EQ("object", JSONSchemaValidator::GetJSONSchemaType(
scoped_ptr<Value>(new DictionaryValue()).get()));
EXPECT_EQ("null", JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateNullValue()).get()));
+ scoped_ptr<Value>(base::NullValue()).get()));
}
void JSONSchemaValidatorTestBase::TestTypes() {
@@ -515,53 +515,53 @@ void JSONSchemaValidatorTestBase::TestTypes() {
schema->SetString("type", "string");
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foobar")).get(),
+ scoped_ptr<Value>(base::StringValue::New("foobar")).get(),
schema.get(), NULL);
schema->SetString("type", "number");
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(88.8)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(0)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(0)).get(),
schema.get(), NULL);
schema->SetString("type", "integer");
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(0)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(0)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get(),
+ base::NumberValue::New(pow(2.0, DBL_MANT_DIG))).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get(),
+ base::NumberValue::New(pow(-2.0, DBL_MANT_DIG))).get(),
schema.get(), NULL);
schema->SetString("type", "boolean");
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(),
+ scoped_ptr<Value>(base::FalseValue()).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateBooleanValue(true)).get(),
+ scoped_ptr<Value>(base::TrueValue()).get(),
schema.get(), NULL);
schema->SetString("type", "null");
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateNullValue()).get(),
+ scoped_ptr<Value>(base::NullValue()).get(),
schema.get(), NULL);
// not valid
@@ -572,56 +572,56 @@ void JSONSchemaValidatorTestBase::TestTypes() {
JSONSchemaValidator::kInvalidType, "object", "array"));
schema->SetString("type", "object");
- ExpectNotValid(TEST_SOURCE, scoped_ptr<Value>(Value::CreateNullValue()).get(),
+ ExpectNotValid(TEST_SOURCE, scoped_ptr<Value>(base::NullValue()).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "object", "null"));
schema->SetString("type", "array");
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(42)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "array", "integer"));
schema->SetString("type", "string");
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(42)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "string", "integer"));
schema->SetString("type", "number");
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("42")).get(),
+ scoped_ptr<Value>(base::StringValue::New("42")).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "number", "string"));
schema->SetString("type", "integer");
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(88.8)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "integer", "number"));
schema->SetString("type", "integer");
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(88.8)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "integer", "number"));
schema->SetString("type", "boolean");
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(1)).get(),
+ scoped_ptr<Value>(base::NumberValue::New(1)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "boolean", "integer"));
schema->SetString("type", "null");
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(),
+ scoped_ptr<Value>(base::FalseValue()).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType, "null", "boolean"));
« no previous file with comments | « chrome/common/json_schema_validator.h ('k') | chrome/renderer/automation/dom_automation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698