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

Unified Diff: components/policy/core/common/schema_unittest.cc

Issue 171403004: Add touch flag to output of Schema::Normalize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split-1
Patch Set: rebase Created 6 years, 10 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 | « components/policy/core/common/schema.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/schema_unittest.cc
diff --git a/components/policy/core/common/schema_unittest.cc b/components/policy/core/common/schema_unittest.cc
index c0c3193eadde8380cd411e13346fa6a6ee1b1e85..8effd896aabab93aaf9ec32abf1f6e6491f4fff1 100644
--- a/components/policy/core/common/schema_unittest.cc
+++ b/components/policy/core/common/schema_unittest.cc
@@ -128,16 +128,21 @@ void TestSchemaValidation(Schema schema,
// Schema::Validate().
error = kNoErrorReturned;
scoped_ptr<base::Value> cloned_value(value.DeepCopy());
- returned = schema.Normalize(cloned_value.get(), strategy, NULL, &error);
+ bool touched = false;
+ returned =
+ schema.Normalize(cloned_value.get(), strategy, NULL, &error, &touched);
EXPECT_EQ(returned, expected_return_value) << error;
+ bool strictly_valid = schema.Validate(value, SCHEMA_STRICT, NULL, &error);
+ EXPECT_EQ(!strictly_valid && returned, touched);
+
// Test that Schema::Normalize() have actually dropped invalid and unknown
// properties.
if (expected_return_value) {
EXPECT_TRUE(
schema.Validate(*cloned_value.get(), SCHEMA_STRICT, NULL, &error));
- EXPECT_TRUE(
- schema.Normalize(cloned_value.get(), SCHEMA_STRICT, NULL, &error));
+ EXPECT_TRUE(schema.Normalize(
+ cloned_value.get(), SCHEMA_STRICT, NULL, &error, NULL));
}
}
« no previous file with comments | « components/policy/core/common/schema.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698