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

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

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 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
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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 DCHECK(store); 253 DCHECK(store);
254 const base::DictionaryValue* hash_store_contents = 254 const base::DictionaryValue* hash_store_contents =
255 DictionaryHashStoreContents(store).GetContents(); 255 DictionaryHashStoreContents(store).GetContents();
256 return hash_store_contents && 256 return hash_store_contents &&
257 hash_store_contents->GetString(expected_pref_in_hash_store, 257 hash_store_contents->GetString(expected_pref_in_hash_store,
258 static_cast<std::string*>(NULL)); 258 static_cast<std::string*>(NULL));
259 } 259 }
260 260
261 // Determines whether |expected_pref_in_hash_store| has a hash in the Local 261 // Determines whether |expected_pref_in_hash_store| has a hash in the Local
262 // State hash store. 262 // State hash store.
263 bool ContainsLegacyHash(std::string expected_pref_in_hash_store) { 263 bool ContainsLegacyHash(const std::string& expected_pref_in_hash_store) {
264 const base::DictionaryValue* hash_store_contents = 264 const base::DictionaryValue* hash_store_contents =
265 PrefServiceHashStoreContents(kHashStoreId, &local_state_).GetContents(); 265 PrefServiceHashStoreContents(kHashStoreId, &local_state_).GetContents();
266 return hash_store_contents && 266 return hash_store_contents &&
267 hash_store_contents->GetString(expected_pref_in_hash_store, 267 hash_store_contents->GetString(expected_pref_in_hash_store,
268 static_cast<std::string*>(NULL)); 268 static_cast<std::string*>(NULL));
269 } 269 }
270 270
271 // Both stores need to hand their prefs over in order for migration to kick 271 // Both stores need to hand their prefs over in order for migration to kick
272 // in. 272 // in.
273 void HandPrefsToMigrator(MockPrefStoreID store_id) { 273 void HandPrefsToMigrator(MockPrefStoreID store_id) {
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 expected_unprotected_values); 896 expected_unprotected_values);
897 897
898 base::StringPairs expected_protected_values; 898 base::StringPairs expected_protected_values;
899 expected_protected_values.push_back(std::make_pair( 899 expected_protected_values.push_back(std::make_pair(
900 kProtectedPref, kProtectedPrefValue)); 900 kProtectedPref, kProtectedPrefValue));
901 expected_protected_values.push_back(std::make_pair( 901 expected_protected_values.push_back(std::make_pair(
902 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue)); 902 kPreviouslyUnprotectedPref, kPreviouslyUnprotectedPrefValue));
903 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values); 903 VerifyValuesStored(MOCK_PROTECTED_PREF_STORE, expected_protected_values);
904 } 904 }
905 } 905 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698