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

Unified Diff: chrome/common/json_schema/json_schema_validator_unittest_base.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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
Index: chrome/common/json_schema/json_schema_validator_unittest_base.cc
diff --git a/chrome/common/json_schema/json_schema_validator_unittest_base.cc b/chrome/common/json_schema/json_schema_validator_unittest_base.cc
index ecd9846f1a94f8552cabf891eb85b42e2d27f7b1..8ce82b77e27d1655ad3fed92394449d695f84275 100644
--- a/chrome/common/json_schema/json_schema_validator_unittest_base.cc
+++ b/chrome/common/json_schema/json_schema_validator_unittest_base.cc
@@ -130,7 +130,9 @@ void JSONSchemaValidatorTestBase::TestStringPattern() {
schema.get(), NULL);
ExpectNotValid(TEST_SOURCE,
scoped_ptr<base::Value>(new base::StringValue("bar")).get(),
- schema.get(), NULL, "",
+ schema.get(),
+ NULL,
+ std::string(),
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kStringPattern, "foo+"));
}
@@ -150,10 +152,16 @@ void JSONSchemaValidatorTestBase::TestEnum() {
ExpectNotValid(TEST_SOURCE,
scoped_ptr<base::Value>(new base::StringValue("42")).get(),
- schema.get(), NULL, "", JSONSchemaValidator::kInvalidEnum);
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::kInvalidEnum);
ExpectNotValid(TEST_SOURCE,
scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(),
- schema.get(), NULL, "", JSONSchemaValidator::kInvalidEnum);
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::kInvalidEnum);
}
void JSONSchemaValidatorTestBase::TestChoices() {
@@ -173,14 +181,24 @@ void JSONSchemaValidatorTestBase::TestChoices() {
ExpectNotValid(TEST_SOURCE,
scoped_ptr<base::Value>(new base::StringValue("foo")).get(),
- schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice);
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::kInvalidChoice);
ExpectNotValid(TEST_SOURCE,
scoped_ptr<base::Value>(new base::ListValue()).get(),
- schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice);
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::kInvalidChoice);
instance->SetInteger("foo", 42);
- ExpectNotValid(TEST_SOURCE, instance.get(),
- schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice);
+ ExpectNotValid(TEST_SOURCE,
+ instance.get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::kInvalidChoice);
}
void JSONSchemaValidatorTestBase::TestExtends() {
@@ -333,7 +351,11 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
instance->Append(new base::StringValue("anything"));
- ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "",
+ ExpectNotValid(TEST_SOURCE,
+ instance.get(),
+ schema.get(),
+ NULL,
+ std::string(),
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kArrayMaxItems, "2"));
@@ -403,13 +425,21 @@ void JSONSchemaValidatorTestBase::TestArrayNonTuple() {
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
instance->Append(new base::StringValue("x"));
- ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "",
+ ExpectNotValid(TEST_SOURCE,
+ instance.get(),
+ schema.get(),
+ NULL,
+ std::string(),
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kArrayMaxItems, "3"));
instance->Remove(1, NULL);
instance->Remove(1, NULL);
instance->Remove(1, NULL);
- ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "",
+ ExpectNotValid(TEST_SOURCE,
+ instance.get(),
+ schema.get(),
+ NULL,
+ std::string(),
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kArrayMinItems, "2"));
@@ -436,15 +466,20 @@ void JSONSchemaValidatorTestBase::TestString() {
new base::StringValue("xxxxxxxxxx")).get(),
schema.get(), NULL);
- ExpectNotValid(TEST_SOURCE,
- scoped_ptr<base::Value>(new base::StringValue("")).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::FormatErrorMessage(
- JSONSchemaValidator::kStringMinLength, "1"));
+ ExpectNotValid(
+ TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::StringValue(std::string())).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::FormatErrorMessage(
+ JSONSchemaValidator::kStringMinLength, "1"));
ExpectNotValid(
TEST_SOURCE,
scoped_ptr<base::Value>(new base::StringValue("xxxxxxxxxxx")).get(),
- schema.get(), NULL, "",
+ schema.get(),
+ NULL,
+ std::string(),
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kStringMaxLength, "10"));
}
@@ -469,16 +504,19 @@ void JSONSchemaValidatorTestBase::TestNumber() {
scoped_ptr<base::Value>(new base::FundamentalValue(88.88)).get(),
schema.get(), NULL);
- ExpectNotValid(
- TEST_SOURCE,
- scoped_ptr<base::Value>(new base::FundamentalValue(0.5)).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::FormatErrorMessage(
- JSONSchemaValidator::kNumberMinimum, "1"));
+ ExpectNotValid(TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::FundamentalValue(0.5)).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::FormatErrorMessage(
+ JSONSchemaValidator::kNumberMinimum, "1"));
ExpectNotValid(
TEST_SOURCE,
scoped_ptr<base::Value>(new base::FundamentalValue(100.1)).get(),
- schema.get(), NULL, "",
+ schema.get(),
+ NULL,
+ std::string(),
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kNumberMaximum, "100"));
}
@@ -606,73 +644,83 @@ void JSONSchemaValidatorTestBase::TestTypes() {
// not valid
schema->SetString(schema::kType, schema::kObject);
- ExpectNotValid(TEST_SOURCE,
- scoped_ptr<base::Value>(new base::ListValue()).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::FormatErrorMessage(
- JSONSchemaValidator::kInvalidType,
- schema::kObject,
- schema::kArray));
+ ExpectNotValid(
+ TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::ListValue()).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::FormatErrorMessage(
+ JSONSchemaValidator::kInvalidType, schema::kObject, schema::kArray));
schema->SetString(schema::kType, schema::kObject);
- ExpectNotValid(TEST_SOURCE,
- scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::FormatErrorMessage(
- JSONSchemaValidator::kInvalidType,
- schema::kObject,
- schema::kNull));
+ ExpectNotValid(
+ TEST_SOURCE,
+ scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::FormatErrorMessage(
+ JSONSchemaValidator::kInvalidType, schema::kObject, schema::kNull));
schema->SetString(schema::kType, schema::kArray);
- ExpectNotValid(TEST_SOURCE,
- scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::FormatErrorMessage(
- JSONSchemaValidator::kInvalidType,
- schema::kArray,
- schema::kInteger));
+ ExpectNotValid(
+ TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::FormatErrorMessage(
+ JSONSchemaValidator::kInvalidType, schema::kArray, schema::kInteger));
schema->SetString(schema::kType, schema::kString);
- ExpectNotValid(TEST_SOURCE,
- scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::FormatErrorMessage(
- JSONSchemaValidator::kInvalidType,
- schema::kString,
- schema::kInteger));
+ ExpectNotValid(
+ TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::FormatErrorMessage(JSONSchemaValidator::kInvalidType,
+ schema::kString,
+ schema::kInteger));
schema->SetString(schema::kType, schema::kNumber);
- ExpectNotValid(TEST_SOURCE,
- scoped_ptr<base::Value>(new base::StringValue("42")).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::FormatErrorMessage(
- JSONSchemaValidator::kInvalidType,
- schema::kNumber,
- schema::kString));
+ ExpectNotValid(
+ TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::StringValue("42")).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::FormatErrorMessage(
+ JSONSchemaValidator::kInvalidType, schema::kNumber, schema::kString));
schema->SetString(schema::kType, schema::kInteger);
- ExpectNotValid(TEST_SOURCE,
- scoped_ptr<base::Value>(
- new base::FundamentalValue(88.8)).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::kInvalidTypeIntegerNumber);
+ ExpectNotValid(
+ TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::FundamentalValue(88.8)).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::kInvalidTypeIntegerNumber);
schema->SetString(schema::kType, schema::kBoolean);
- ExpectNotValid(TEST_SOURCE,
- scoped_ptr<base::Value>(new base::FundamentalValue(1)).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::FormatErrorMessage(
- JSONSchemaValidator::kInvalidType,
- schema::kBoolean,
- schema::kInteger));
+ ExpectNotValid(
+ TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::FundamentalValue(1)).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::FormatErrorMessage(JSONSchemaValidator::kInvalidType,
+ schema::kBoolean,
+ schema::kInteger));
schema->SetString(schema::kType, schema::kNull);
- ExpectNotValid(TEST_SOURCE,
- scoped_ptr<base::Value>(
- new base::FundamentalValue(false)).get(),
- schema.get(), NULL, "",
- JSONSchemaValidator::FormatErrorMessage(
- JSONSchemaValidator::kInvalidType,
- schema::kNull,
- schema::kBoolean));
+ ExpectNotValid(
+ TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::FundamentalValue(false)).get(),
+ schema.get(),
+ NULL,
+ std::string(),
+ JSONSchemaValidator::FormatErrorMessage(
+ JSONSchemaValidator::kInvalidType, schema::kNull, schema::kBoolean));
}
« no previous file with comments | « chrome/common/json_schema/json_schema_validator.cc ('k') | chrome/common/metrics/entropy_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698