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 "components/user_prefs/tracked/tracked_preferences_migration.h" | 5 #include "components/user_prefs/tracked/tracked_preferences_migration.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 store = unprotected_prefs_.get(); | 156 store = unprotected_prefs_.get(); |
157 pref_hash_store.reset(new PrefHashStoreImpl(kSeed, kDeviceId, false)); | 157 pref_hash_store.reset(new PrefHashStoreImpl(kSeed, kDeviceId, false)); |
158 break; | 158 break; |
159 case MOCK_PROTECTED_PREF_STORE: | 159 case MOCK_PROTECTED_PREF_STORE: |
160 store = protected_prefs_.get(); | 160 store = protected_prefs_.get(); |
161 pref_hash_store.reset(new PrefHashStoreImpl(kSeed, kDeviceId, true)); | 161 pref_hash_store.reset(new PrefHashStoreImpl(kSeed, kDeviceId, true)); |
162 break; | 162 break; |
163 } | 163 } |
164 DCHECK(store); | 164 DCHECK(store); |
165 | 165 |
166 base::StringValue string_value(value); | 166 base::Value string_value(value); |
167 DictionaryHashStoreContents contents(store); | 167 DictionaryHashStoreContents contents(store); |
168 pref_hash_store->BeginTransaction(&contents)->StoreHash(key, &string_value); | 168 pref_hash_store->BeginTransaction(&contents)->StoreHash(key, &string_value); |
169 } | 169 } |
170 | 170 |
171 // Returns true if the store opposite to |store_id| is observed for its next | 171 // Returns true if the store opposite to |store_id| is observed for its next |
172 // successful write. | 172 // successful write. |
173 bool WasOnSuccessfulWriteCallbackRegistered(MockPrefStoreID store_id) { | 173 bool WasOnSuccessfulWriteCallbackRegistered(MockPrefStoreID store_id) { |
174 switch (store_id) { | 174 switch (store_id) { |
175 case MOCK_UNPROTECTED_PREF_STORE: | 175 case MOCK_UNPROTECTED_PREF_STORE: |
176 return !protected_store_successful_write_callback_.is_null(); | 176 return !protected_store_successful_write_callback_.is_null(); |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 expected_unprotected_values); | 646 expected_unprotected_values); |
647 | 647 |
648 base::StringPairs expected_protected_values; | 648 base::StringPairs expected_protected_values; |
649 expected_protected_values.push_back(std::make_pair( | 649 expected_protected_values.push_back(std::make_pair( |
650 kProtectedPref, kProtectedPrefValue)); | 650 kProtectedPref, kProtectedPrefValue)); |
651 expected_protected_values.push_back(std::make_pair( | 651 expected_protected_values.push_back(std::make_pair( |
652 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue)); | 652 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue)); |
653 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values); | 653 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values); |
654 } | 654 } |
655 } | 655 } |
OLD | NEW |