OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 const base::FilePath& pref_file) { | 110 const base::FilePath& pref_file) { |
111 JSONFileValueDeserializer deserializer(pref_file); | 111 JSONFileValueDeserializer deserializer(pref_file); |
112 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; | 112 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; |
113 std::string error_str; | 113 std::string error_str; |
114 std::unique_ptr<base::Value> prefs = | 114 std::unique_ptr<base::Value> prefs = |
115 deserializer.Deserialize(&error_code, &error_str); | 115 deserializer.Deserialize(&error_code, &error_str); |
116 if (!prefs || error_code != JSONFileValueDeserializer::JSON_NO_ERROR) { | 116 if (!prefs || error_code != JSONFileValueDeserializer::JSON_NO_ERROR) { |
117 ADD_FAILURE() << "Error #" << error_code << ": " << error_str; | 117 ADD_FAILURE() << "Error #" << error_code << ": " << error_str; |
118 return std::unique_ptr<base::DictionaryValue>(); | 118 return std::unique_ptr<base::DictionaryValue>(); |
119 } | 119 } |
120 if (!prefs->IsType(base::Value::TYPE_DICTIONARY)) { | 120 if (!prefs->IsType(base::Value::Type::DICTIONARY)) { |
121 ADD_FAILURE(); | 121 ADD_FAILURE(); |
122 return std::unique_ptr<base::DictionaryValue>(); | 122 return std::unique_ptr<base::DictionaryValue>(); |
123 } | 123 } |
124 return std::unique_ptr<base::DictionaryValue>( | 124 return std::unique_ptr<base::DictionaryValue>( |
125 static_cast<base::DictionaryValue*>(prefs.release())); | 125 static_cast<base::DictionaryValue*>(prefs.release())); |
126 } | 126 } |
127 | 127 |
128 // Returns whether external validation is supported on the platform through | 128 // Returns whether external validation is supported on the platform through |
129 // storing MACs in the registry. | 129 // storing MACs in the registry. |
130 bool SupportsRegistryValidation() { | 130 bool SupportsRegistryValidation() { |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 user_prefs::tracked::kTrackedPrefHistogramChanged, | 1164 user_prefs::tracked::kTrackedPrefHistogramChanged, |
1165 user_prefs::tracked::kTrackedPrefRegistryValidationSuffix, | 1165 user_prefs::tracked::kTrackedPrefRegistryValidationSuffix, |
1166 BEGIN_ALLOW_SINGLE_BUCKET + 2)); | 1166 BEGIN_ALLOW_SINGLE_BUCKET + 2)); |
1167 } | 1167 } |
1168 } | 1168 } |
1169 }; | 1169 }; |
1170 | 1170 |
1171 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestRegistryValidationFailure, | 1171 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestRegistryValidationFailure, |
1172 RegistryValidationFailure); | 1172 RegistryValidationFailure); |
1173 #endif | 1173 #endif |
OLD | NEW |