OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/policy/preg_parser_win.h" | 5 #include "chrome/browser/policy/preg_parser_win.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 return result; | 36 return result; |
37 } | 37 } |
38 | 38 |
39 RegistryDict::ValueMap::const_iterator iter_value_a(a.values().begin()); | 39 RegistryDict::ValueMap::const_iterator iter_value_a(a.values().begin()); |
40 RegistryDict::ValueMap::const_iterator iter_value_b(b.values().begin()); | 40 RegistryDict::ValueMap::const_iterator iter_value_b(b.values().begin()); |
41 for (; iter_value_a != a.values().end() && iter_value_b != b.values().end(); | 41 for (; iter_value_a != a.values().end() && iter_value_b != b.values().end(); |
42 ++iter_value_a, ++iter_value_b) { | 42 ++iter_value_a, ++iter_value_b) { |
43 if (iter_value_a->first != iter_value_b->first || | 43 if (iter_value_a->first != iter_value_b->first || |
44 !base::Value::Equals(iter_value_a->second, iter_value_b->second)) { | 44 !base::Value::Equals(iter_value_a->second, iter_value_b->second)) { |
45 return testing::AssertionFailure() | 45 return testing::AssertionFailure() |
46 << "Value mismatch " << iter_value_a->first | 46 << "Value mismatch " |
47 << " vs. " << iter_value_b->first; | 47 << iter_value_a->first << "=" << *iter_value_a->second |
| 48 << " vs. " << iter_value_b->first << "=" << *iter_value_b->second; |
48 } | 49 } |
49 } | 50 } |
50 | 51 |
51 return testing::AssertionSuccess(); | 52 return testing::AssertionSuccess(); |
52 } | 53 } |
53 | 54 |
54 void SetInteger(RegistryDict* dict, | 55 void SetInteger(RegistryDict* dict, |
55 const std::string& name, | 56 const std::string& name, |
56 int value) { | 57 int value) { |
57 dict->SetValue( | 58 dict->SetValue( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 expected.SetKey("DelValsTest", del_vals_dict.Pass()); | 102 expected.SetKey("DelValsTest", del_vals_dict.Pass()); |
102 SetInteger(&expected, "HomepageIsNewTabPage", 1); | 103 SetInteger(&expected, "HomepageIsNewTabPage", 1); |
103 SetString(&expected, "HomepageLocation", "http://www.example.com"); | 104 SetString(&expected, "HomepageLocation", "http://www.example.com"); |
104 SetInteger(&expected, "RestoreOnStartup", 4); | 105 SetInteger(&expected, "RestoreOnStartup", 4); |
105 scoped_ptr<RegistryDict> startup_urls(new RegistryDict()); | 106 scoped_ptr<RegistryDict> startup_urls(new RegistryDict()); |
106 SetString(startup_urls.get(), "1", "http://www.chromium.org"); | 107 SetString(startup_urls.get(), "1", "http://www.chromium.org"); |
107 SetString(startup_urls.get(), "2", "http://www.example.com"); | 108 SetString(startup_urls.get(), "2", "http://www.example.com"); |
108 expected.SetKey("RestoreOnStartupURLs", startup_urls.Pass()); | 109 expected.SetKey("RestoreOnStartupURLs", startup_urls.Pass()); |
109 SetInteger(&expected, "ShowHomeButton", 1); | 110 SetInteger(&expected, "ShowHomeButton", 1); |
110 SetString(&expected, "Snowman", "\xE2\x98\x83"); | 111 SetString(&expected, "Snowman", "\xE2\x98\x83"); |
| 112 SetString(&expected, "Empty", ""); |
111 | 113 |
112 EXPECT_TRUE(RegistryDictEquals(dict, expected)); | 114 EXPECT_TRUE(RegistryDictEquals(dict, expected)); |
113 } | 115 } |
114 | 116 |
115 } // namespace | 117 } // namespace |
116 } // namespace preg_parser | 118 } // namespace preg_parser |
117 } // namespace policy | 119 } // namespace policy |
OLD | NEW |