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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 } | 82 } |
83 return sum; | 83 return sum; |
84 } | 84 } |
85 | 85 |
86 scoped_ptr<base::DictionaryValue> ReadPrefsDictionary( | 86 scoped_ptr<base::DictionaryValue> ReadPrefsDictionary( |
87 const base::FilePath& pref_file) { | 87 const base::FilePath& pref_file) { |
88 JSONFileValueDeserializer deserializer(pref_file); | 88 JSONFileValueDeserializer deserializer(pref_file); |
89 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; | 89 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; |
90 std::string error_str; | 90 std::string error_str; |
91 scoped_ptr<base::Value> prefs( | 91 scoped_ptr<base::Value> prefs = |
92 deserializer.Deserialize(&error_code, &error_str)); | 92 deserializer.Deserialize(&error_code, &error_str); |
93 if (!prefs || error_code != JSONFileValueDeserializer::JSON_NO_ERROR) { | 93 if (!prefs || error_code != JSONFileValueDeserializer::JSON_NO_ERROR) { |
94 ADD_FAILURE() << "Error #" << error_code << ": " << error_str; | 94 ADD_FAILURE() << "Error #" << error_code << ": " << error_str; |
95 return scoped_ptr<base::DictionaryValue>(); | 95 return scoped_ptr<base::DictionaryValue>(); |
96 } | 96 } |
97 if (!prefs->IsType(base::Value::TYPE_DICTIONARY)) { | 97 if (!prefs->IsType(base::Value::TYPE_DICTIONARY)) { |
98 ADD_FAILURE(); | 98 ADD_FAILURE(); |
99 return scoped_ptr<base::DictionaryValue>(); | 99 return scoped_ptr<base::DictionaryValue>(); |
100 } | 100 } |
101 return scoped_ptr<base::DictionaryValue>( | 101 return scoped_ptr<base::DictionaryValue>( |
102 static_cast<base::DictionaryValue*>(prefs.release())); | 102 static_cast<base::DictionaryValue*>(prefs.release())); |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 "Settings.TrackedPreferenceNullInitialized", ALLOW_NONE)); | 917 "Settings.TrackedPreferenceNullInitialized", ALLOW_NONE)); |
918 EXPECT_EQ( | 918 EXPECT_EQ( |
919 0, | 919 0, |
920 GetTrackedPrefHistogramCount( | 920 GetTrackedPrefHistogramCount( |
921 "Settings.TrackedPreferenceMigratedLegacyDeviceId", ALLOW_NONE)); | 921 "Settings.TrackedPreferenceMigratedLegacyDeviceId", ALLOW_NONE)); |
922 } | 922 } |
923 }; | 923 }; |
924 | 924 |
925 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUntrustedAdditionToPrefsAfterWipe, | 925 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUntrustedAdditionToPrefsAfterWipe, |
926 UntrustedAdditionToPrefsAfterWipe); | 926 UntrustedAdditionToPrefsAfterWipe); |
OLD | NEW |