Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: components/user_prefs/tracked/tracked_preferences_migration_unittest.cc

Issue 2297373002: Refactor PrefHashStore's BeginTransaction to take a rawptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments on #1 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/user_prefs/tracked/tracked_preferences_migration.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 pref_hash_store.reset(new PrefHashStoreImpl(kSeed, kDeviceId, false)); 155 pref_hash_store.reset(new PrefHashStoreImpl(kSeed, kDeviceId, false));
156 break; 156 break;
157 case MOCK_PROTECTED_PREF_STORE: 157 case MOCK_PROTECTED_PREF_STORE:
158 store = protected_prefs_.get(); 158 store = protected_prefs_.get();
159 pref_hash_store.reset(new PrefHashStoreImpl(kSeed, kDeviceId, true)); 159 pref_hash_store.reset(new PrefHashStoreImpl(kSeed, kDeviceId, true));
160 break; 160 break;
161 } 161 }
162 DCHECK(store); 162 DCHECK(store);
163 163
164 base::StringValue string_value(value); 164 base::StringValue string_value(value);
165 pref_hash_store 165 DictionaryHashStoreContents contents(store);
166 ->BeginTransaction(std::unique_ptr<HashStoreContents>( 166 pref_hash_store->BeginTransaction(&contents)->StoreHash(key, &string_value);
167 new DictionaryHashStoreContents(store)))
168 ->StoreHash(key, &string_value);
169 } 167 }
170 168
171 // Returns true if the store opposite to |store_id| is observed for its next 169 // Returns true if the store opposite to |store_id| is observed for its next
172 // successful write. 170 // successful write.
173 bool WasOnSuccessfulWriteCallbackRegistered(MockPrefStoreID store_id) { 171 bool WasOnSuccessfulWriteCallbackRegistered(MockPrefStoreID store_id) {
174 switch (store_id) { 172 switch (store_id) {
175 case MOCK_UNPROTECTED_PREF_STORE: 173 case MOCK_UNPROTECTED_PREF_STORE:
176 return !protected_store_successful_write_callback_.is_null(); 174 return !protected_store_successful_write_callback_.is_null();
177 case MOCK_PROTECTED_PREF_STORE: 175 case MOCK_PROTECTED_PREF_STORE:
178 return !unprotected_store_successful_write_callback_.is_null(); 176 return !unprotected_store_successful_write_callback_.is_null();
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 expected_unprotected_values); 644 expected_unprotected_values);
647 645
648 base::StringPairs expected_protected_values; 646 base::StringPairs expected_protected_values;
649 expected_protected_values.push_back(std::make_pair( 647 expected_protected_values.push_back(std::make_pair(
650 kProtectedPref, kProtectedPrefValue)); 648 kProtectedPref, kProtectedPrefValue));
651 expected_protected_values.push_back(std::make_pair( 649 expected_protected_values.push_back(std::make_pair(
652 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue)); 650 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue));
653 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values); 651 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values);
654 } 652 }
655 } 653 }
OLDNEW
« no previous file with comments | « components/user_prefs/tracked/tracked_preferences_migration.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698