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/profile_pref_store_manager.h" | 5 #include "chrome/browser/prefs/profile_pref_store_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/files/file_enumerator.h" | 14 #include "base/files/file_enumerator.h" |
14 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
15 #include "base/files/scoped_temp_dir.h" | 16 #include "base/files/scoped_temp_dir.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
19 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 EXPECT_NE(ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking, | 313 EXPECT_NE(ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking, |
313 pref_store_->GetValue(kProtectedAtomic, NULL)); | 314 pref_store_->GetValue(kProtectedAtomic, NULL)); |
314 VerifyResetRecorded( | 315 VerifyResetRecorded( |
315 ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking); | 316 ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking); |
316 | 317 |
317 ExpectValidationObserved(kTrackedAtomic); | 318 ExpectValidationObserved(kTrackedAtomic); |
318 ExpectValidationObserved(kProtectedAtomic); | 319 ExpectValidationObserved(kProtectedAtomic); |
319 } | 320 } |
320 | 321 |
321 TEST_F(ProfilePrefStoreManagerTest, InitializePrefsFromMasterPrefs) { | 322 TEST_F(ProfilePrefStoreManagerTest, InitializePrefsFromMasterPrefs) { |
322 base::DictionaryValue master_prefs; | 323 std::unique_ptr<base::DictionaryValue> master_prefs = |
grt (UTC plus 2)
2017/02/23 21:19:01
auto here, too
gab
2017/02/23 23:27:53
Done.
| |
323 master_prefs.Set(kTrackedAtomic, new base::StringValue(kFoobar)); | 324 base::MakeUnique<base::DictionaryValue>(); |
324 master_prefs.Set(kProtectedAtomic, new base::StringValue(kHelloWorld)); | 325 master_prefs->Set(kTrackedAtomic, new base::StringValue(kFoobar)); |
325 EXPECT_TRUE(manager_->InitializePrefsFromMasterPrefs(master_prefs)); | 326 master_prefs->Set(kProtectedAtomic, new base::StringValue(kHelloWorld)); |
327 EXPECT_TRUE( | |
328 manager_->InitializePrefsFromMasterPrefs(std::move(master_prefs))); | |
326 | 329 |
327 LoadExistingPrefs(); | 330 LoadExistingPrefs(); |
328 | 331 |
329 // Verify that InitializePrefsFromMasterPrefs correctly applied the MACs | 332 // Verify that InitializePrefsFromMasterPrefs correctly applied the MACs |
330 // necessary to authenticate these values. | 333 // necessary to authenticate these values. |
331 ExpectStringValueEquals(kTrackedAtomic, kFoobar); | 334 ExpectStringValueEquals(kTrackedAtomic, kFoobar); |
332 ExpectStringValueEquals(kProtectedAtomic, kHelloWorld); | 335 ExpectStringValueEquals(kProtectedAtomic, kHelloWorld); |
333 VerifyResetRecorded(false); | 336 VerifyResetRecorded(false); |
334 } | 337 } |
335 | 338 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 | 483 |
481 // Trigger the logic that migrates it back to the unprotected preferences | 484 // Trigger the logic that migrates it back to the unprotected preferences |
482 // file. | 485 // file. |
483 pref_store_->SetValue(kProtectedAtomic, | 486 pref_store_->SetValue(kProtectedAtomic, |
484 base::WrapUnique(new base::StringValue(kGoodbyeWorld)), | 487 base::WrapUnique(new base::StringValue(kGoodbyeWorld)), |
485 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 488 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
486 LoadExistingPrefs(); | 489 LoadExistingPrefs(); |
487 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); | 490 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); |
488 VerifyResetRecorded(false); | 491 VerifyResetRecorded(false); |
489 } | 492 } |
OLD | NEW |