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

Unified Diff: tools/json_schema_compiler/test/error_generation_unittest.cc

Issue 2149253003: Switch various ValueTypeToString()s to base::Value::GetTypeName(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@value
Patch Set: fix tests Created 4 years, 5 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: tools/json_schema_compiler/test/error_generation_unittest.cc
diff --git a/tools/json_schema_compiler/test/error_generation_unittest.cc b/tools/json_schema_compiler/test/error_generation_unittest.cc
index 5f7480180d816411d56ddb649158e063729935e4..5c3f1b800e344aed7e526e0875b03e74a8d8c469 100644
--- a/tools/json_schema_compiler/test/error_generation_unittest.cc
+++ b/tools/json_schema_compiler/test/error_generation_unittest.cc
@@ -24,9 +24,10 @@ base::string16 GetPopulateError(const base::Value& value) {
testing::AssertionResult EqualsUtf16(const std::string& expected,
const base::string16& actual) {
- if (base::ASCIIToUTF16(expected) != actual)
- return testing::AssertionFailure() << expected << " != " << actual;
- return testing::AssertionSuccess();
+ if (base::ASCIIToUTF16(expected) == actual)
+ return testing::AssertionSuccess();
+ return testing::AssertionFailure() << "\n actual: " << actual
+ << "\n expected: " << expected;
}
// GenerateTypePopulate errors
@@ -119,7 +120,7 @@ TEST(JsonSchemaCompilerErrorTest, WrongPropertyValueType) {
{
std::unique_ptr<base::DictionaryValue> value =
Dictionary("string", new FundamentalValue(1.1));
- EXPECT_TRUE(EqualsUtf16("'string': expected string, got number",
+ EXPECT_TRUE(EqualsUtf16("'string': expected string, got double",
GetPopulateError<TestType>(*value)));
}
}
@@ -152,7 +153,7 @@ TEST(JsonSchemaCompilerErrorTest, WrongTypeValueType) {
ObjectType out;
base::string16 error;
EXPECT_TRUE(ObjectType::Populate(*value, &out, &error));
- EXPECT_TRUE(EqualsUtf16("'otherType': expected dictionary, got number",
+ EXPECT_TRUE(EqualsUtf16("'otherType': expected dictionary, got double",
error));
EXPECT_EQ(NULL, out.other_type.get());
}
@@ -183,7 +184,7 @@ TEST(JsonSchemaCompilerErrorTest, BinaryTypeExpected) {
{
std::unique_ptr<base::DictionaryValue> value =
Dictionary("data", new FundamentalValue(1.1));
- EXPECT_TRUE(EqualsUtf16("'data': expected binary, got number",
+ EXPECT_TRUE(EqualsUtf16("'data': expected binary, got double",
GetPopulateError<BinaryData>(*value)));
}
}

Powered by Google App Engine
This is Rietveld 408576698