| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 if (allowed_buckets == ALLOW_NONE || | 78 if (allowed_buckets == ALLOW_NONE || |
| 79 (allowed_buckets != ALLOW_ANY && i != allowed_buckets)) { | 79 (allowed_buckets != ALLOW_ANY && i != allowed_buckets)) { |
| 80 EXPECT_EQ(0, count_for_id) << "Unexpected reporting_id: " << i; | 80 EXPECT_EQ(0, count_for_id) << "Unexpected reporting_id: " << i; |
| 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 JSONFileValueSerializer serializer(pref_file); | 88 JSONFileValueDeserializer deserializer(pref_file); |
| 89 int error_code = JSONFileValueSerializer::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 serializer.Deserialize(&error_code, &error_str)); | 92 deserializer.Deserialize(&error_code, &error_str)); |
| 93 if (!prefs || error_code != JSONFileValueSerializer::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())); |
| 103 } | 103 } |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 "Settings.TrackedPreferenceNullInitialized", ALLOW_NONE)); | 918 "Settings.TrackedPreferenceNullInitialized", ALLOW_NONE)); |
| 919 EXPECT_EQ( | 919 EXPECT_EQ( |
| 920 0, | 920 0, |
| 921 GetTrackedPrefHistogramCount( | 921 GetTrackedPrefHistogramCount( |
| 922 "Settings.TrackedPreferenceMigratedLegacyDeviceId", ALLOW_NONE)); | 922 "Settings.TrackedPreferenceMigratedLegacyDeviceId", ALLOW_NONE)); |
| 923 } | 923 } |
| 924 }; | 924 }; |
| 925 | 925 |
| 926 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUntrustedAdditionToPrefsAfterWipe, | 926 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUntrustedAdditionToPrefsAfterWipe, |
| 927 UntrustedAdditionToPrefsAfterWipe); | 927 UntrustedAdditionToPrefsAfterWipe); |
| OLD | NEW |