Chromium Code Reviews| Index: components/policy/core/common/registry_dict_win_unittest.cc |
| diff --git a/components/policy/core/common/registry_dict_win_unittest.cc b/components/policy/core/common/registry_dict_win_unittest.cc |
| index ac4d79cc91d0c8d84e128fcd6f94efdf19553d48..efdf815ec419f21c4a46628e2c7161ae526f5d32 100644 |
| --- a/components/policy/core/common/registry_dict_win_unittest.cc |
| +++ b/components/policy/core/common/registry_dict_win_unittest.cc |
| @@ -222,7 +222,8 @@ TEST(RegistryDictTest, ConvertToJSON) { |
| " \"string-to-int\": { \"type\": \"integer\" }," |
| " \"string-to-dict\": { \"type\": \"object\" }" |
| " }" |
| - "}", &error); |
| + "}", |
| + &error); |
|
Georges Khalil
2016/11/03 16:04:31
Result of git cl format.
|
| ASSERT_TRUE(schema.valid()) << error; |
| std::unique_ptr<base::Value> actual(test_dict.ConvertToJSON(schema)); |
| @@ -251,6 +252,41 @@ TEST(RegistryDictTest, ConvertToJSON) { |
| EXPECT_TRUE(base::Value::Equals(actual.get(), &expected)); |
| } |
| +TEST(RegistryDictTest, NonSequentialConvertToJSON) { |
| + RegistryDict test_dict; |
| + |
| + std::unique_ptr<RegistryDict> list(new RegistryDict()); |
| + list->SetValue("1", base::StringValue("1").CreateDeepCopy()); |
| + list->SetValue("2", base::StringValue("2").CreateDeepCopy()); |
| + list->SetValue("4", base::StringValue("4").CreateDeepCopy()); |
| + test_dict.SetKey("dict-to-list", std::move(list)); |
| + |
| + std::string error; |
| + Schema schema = Schema::Parse( |
| + "{" |
| + " \"type\": \"object\"," |
| + " \"properties\": {" |
| + " \"dict-to-list\": {" |
| + " \"type\": \"array\"," |
| + " \"items\": { \"type\": \"string\" }" |
| + " }" |
| + " }" |
| + "}", |
| + &error); |
| + ASSERT_TRUE(schema.valid()) << error; |
| + |
| + std::unique_ptr<base::Value> actual(test_dict.ConvertToJSON(schema)); |
| + |
| + base::DictionaryValue expected; |
| + std::unique_ptr<base::ListValue> expected_list(new base::ListValue()); |
| + expected_list->Append(base::StringValue("1").CreateDeepCopy()); |
| + expected_list->Append(base::StringValue("2").CreateDeepCopy()); |
| + expected_list->Append(base::StringValue("4").CreateDeepCopy()); |
| + expected.Set("dict-to-list", std::move(expected_list)); |
| + |
| + EXPECT_TRUE(base::Value::Equals(actual.get(), &expected)); |
| +} |
| + |
| TEST(RegistryDictTest, KeyValueNameClashes) { |
| RegistryDict test_dict; |