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 "chrome/browser/prefs/tracked/tracked_preferences_migration.h" | 5 #include "components/user_prefs/tracked/tracked_preferences_migration.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/prefs/testing_pref_service.h" | 14 #include "base/prefs/testing_pref_service.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/prefs/profile_pref_store_manager.h" | 17 #include "components/user_prefs/tracked/dictionary_hash_store_contents.h" |
18 #include "chrome/browser/prefs/tracked/dictionary_hash_store_contents.h" | 18 #include "components/user_prefs/tracked/hash_store_contents.h" |
19 #include "chrome/browser/prefs/tracked/hash_store_contents.h" | 19 #include "components/user_prefs/tracked/interceptable_pref_filter.h" |
20 #include "chrome/browser/prefs/tracked/interceptable_pref_filter.h" | 20 #include "components/user_prefs/tracked/pref_hash_store.h" |
21 #include "chrome/browser/prefs/tracked/pref_hash_store.h" | 21 #include "components/user_prefs/tracked/pref_hash_store_impl.h" |
22 #include "chrome/browser/prefs/tracked/pref_hash_store_impl.h" | 22 #include "components/user_prefs/tracked/pref_hash_store_transaction.h" |
23 #include "chrome/browser/prefs/tracked/pref_hash_store_transaction.h" | 23 #include "components/user_prefs/tracked/pref_service_hash_store_contents.h" |
24 #include "chrome/browser/prefs/tracked/pref_service_hash_store_contents.h" | 24 #include "components/user_prefs/tracked/tracked_preferences_migration.h" |
25 #include "chrome/browser/prefs/tracked/tracked_preferences_migration.h" | |
26 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
27 | 26 |
28 namespace { | 27 namespace { |
29 | 28 |
30 // An unprotected pref. | 29 // An unprotected pref. |
31 const char kUnprotectedPref[] = "unprotected"; | 30 const char kUnprotectedPref[] = "unprotected"; |
32 // A protected pref. | 31 // A protected pref. |
33 const char kProtectedPref[] = "protected"; | 32 const char kProtectedPref[] = "protected"; |
34 // A protected pref which is initially stored in the unprotected store. | 33 // A protected pref which is initially stored in the unprotected store. |
35 const char kPreviouslyUnprotectedPref[] = "previously.unprotected"; | 34 const char kPreviouslyUnprotectedPref[] = "previously.unprotected"; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 77 |
79 TrackedPreferencesMigrationTest() | 78 TrackedPreferencesMigrationTest() |
80 : unprotected_prefs_(new base::DictionaryValue), | 79 : unprotected_prefs_(new base::DictionaryValue), |
81 protected_prefs_(new base::DictionaryValue), | 80 protected_prefs_(new base::DictionaryValue), |
82 migration_modified_unprotected_store_(false), | 81 migration_modified_unprotected_store_(false), |
83 migration_modified_protected_store_(false), | 82 migration_modified_protected_store_(false), |
84 unprotected_store_migration_complete_(false), | 83 unprotected_store_migration_complete_(false), |
85 protected_store_migration_complete_(false) {} | 84 protected_store_migration_complete_(false) {} |
86 | 85 |
87 void SetUp() override { | 86 void SetUp() override { |
88 ProfilePrefStoreManager::RegisterPrefs(local_state_.registry()); | 87 PrefServiceHashStoreContents::RegisterPrefs(local_state_.registry()); |
89 Reset(); | 88 Reset(); |
90 } | 89 } |
91 | 90 |
92 void Reset() { | 91 void Reset() { |
93 std::set<std::string> unprotected_pref_names; | 92 std::set<std::string> unprotected_pref_names; |
94 std::set<std::string> protected_pref_names; | 93 std::set<std::string> protected_pref_names; |
95 unprotected_pref_names.insert(kUnprotectedPref); | 94 unprotected_pref_names.insert(kUnprotectedPref); |
96 unprotected_pref_names.insert(kPreviouslyProtectedPref); | 95 unprotected_pref_names.insert(kPreviouslyProtectedPref); |
97 protected_pref_names.insert(kProtectedPref); | 96 protected_pref_names.insert(kProtectedPref); |
98 protected_pref_names.insert(kPreviouslyUnprotectedPref); | 97 protected_pref_names.insert(kPreviouslyUnprotectedPref); |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 expected_unprotected_values); | 896 expected_unprotected_values); |
898 | 897 |
899 base::StringPairs expected_protected_values; | 898 base::StringPairs expected_protected_values; |
900 expected_protected_values.push_back(std::make_pair( | 899 expected_protected_values.push_back(std::make_pair( |
901 kProtectedPref, kProtectedPrefValue)); | 900 kProtectedPref, kProtectedPrefValue)); |
902 expected_protected_values.push_back(std::make_pair( | 901 expected_protected_values.push_back(std::make_pair( |
903 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue)); | 902 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue)); |
904 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values); | 903 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values); |
905 } | 904 } |
906 } | 905 } |
OLD | NEW |