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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/files/file_enumerator.h" | 11 #include "base/files/file_enumerator.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/prefs/json_pref_store.h" | 16 #include "base/prefs/json_pref_store.h" |
17 #include "base/prefs/persistent_pref_store.h" | 17 #include "base/prefs/persistent_pref_store.h" |
18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
19 #include "base/prefs/pref_service_factory.h" | 19 #include "base/prefs/pref_service_factory.h" |
20 #include "base/prefs/pref_store.h" | 20 #include "base/prefs/pref_store.h" |
21 #include "base/prefs/testing_pref_service.h" | 21 #include "base/prefs/testing_pref_service.h" |
22 #include "base/run_loop.h" | 22 #include "base/run_loop.h" |
23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
24 #include "base/values.h" | 24 #include "base/values.h" |
25 #include "chrome/browser/prefs/pref_hash_filter.h" | 25 #include "chrome/browser/prefs/pref_hash_filter.h" |
26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
27 #include "components/user_prefs/pref_registry_syncable.h" | 27 #include "components/pref_registry/pref_registry_syncable.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 class FirstEqualsPredicate { | 32 class FirstEqualsPredicate { |
33 public: | 33 public: |
34 explicit FirstEqualsPredicate(const std::string& expected) | 34 explicit FirstEqualsPredicate(const std::string& expected) |
35 : expected_(expected) {} | 35 : expected_(expected) {} |
36 bool operator()(const std::pair<std::string, base::Value*>& pair) { | 36 bool operator()(const std::pair<std::string, base::Value*>& pair) { |
37 return pair.first == expected_; | 37 return pair.first == expected_; |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 LoadExistingPrefs(); | 466 LoadExistingPrefs(); |
467 ExpectStringValueEquals(kProtectedAtomic, kHelloWorld); | 467 ExpectStringValueEquals(kProtectedAtomic, kHelloWorld); |
468 | 468 |
469 // Trigger the logic that migrates it back to the unprotected preferences | 469 // Trigger the logic that migrates it back to the unprotected preferences |
470 // file. | 470 // file. |
471 pref_store_->SetValue(kProtectedAtomic, new base::StringValue(kGoodbyeWorld)); | 471 pref_store_->SetValue(kProtectedAtomic, new base::StringValue(kGoodbyeWorld)); |
472 LoadExistingPrefs(); | 472 LoadExistingPrefs(); |
473 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); | 473 ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); |
474 EXPECT_FALSE(WasResetRecorded()); | 474 EXPECT_FALSE(WasResetRecorded()); |
475 } | 475 } |
OLD | NEW |