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

Unified Diff: chrome/browser/policy/registry_dict_win_unittest.cc

Issue 22645011: policy: use JSON schema to deserialize entries from Windows registry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix 3rd party policy unit tests Created 7 years, 3 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/browser/policy/registry_dict_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/registry_dict_win_unittest.cc
diff --git a/chrome/browser/policy/registry_dict_win_unittest.cc b/chrome/browser/policy/registry_dict_win_unittest.cc
index 6f313976510dad7048f3fc00964f0c6840e16c86..4ea69192c7cd3a0d11cfc2ae4d7b8965cc9e4644 100644
--- a/chrome/browser/policy/registry_dict_win_unittest.cc
+++ b/chrome/browser/policy/registry_dict_win_unittest.cc
@@ -196,15 +196,22 @@ TEST(RegistryDictTest, ConvertToJSON) {
list->SetValue("1", make_scoped_ptr(string_value.DeepCopy()));
test_dict.SetKey("four", list.Pass());
- base::DictionaryValue schema;
- scoped_ptr<base::DictionaryValue> list_schema(new base::DictionaryValue());
- list_schema->SetString(schema::kType, schema::kArray);
- scoped_ptr<base::DictionaryValue> properties(new base::DictionaryValue());
- properties->Set("four", list_schema.release());
- schema.SetString(schema::kType, schema::kObject);
- schema.Set(schema::kProperties, properties.release());
-
- scoped_ptr<base::Value> actual(test_dict.ConvertToJSON(&schema));
+ std::string err = "";
+ scoped_ptr<PolicySchema> schema(PolicySchema::Parse(
+ "{\n"
+ " \"$schema\": \"http://json-schema.org/draft-03/schema#\",\n"
+ " \"type\": \"object\",\n"
+ " \"properties\": {\n"
+ " \"four\": {\n"
+ " \"type\": \"array\",\n"
+ " \"items\": { \"type\": \"string\" }\n"
+ " }\n"
+ " }\n"
+ "}\n",
+ &err));
+ EXPECT_EQ("", err);
+
+ scoped_ptr<base::Value> actual(test_dict.ConvertToJSON(schema.get()));
base::DictionaryValue expected;
expected.Set("one", int_value.DeepCopy());
« no previous file with comments | « chrome/browser/policy/registry_dict_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698