| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/prefs/pref_value_store.h" |
| 6 |
| 7 #include <memory> |
| 5 #include <string> | 8 #include <string> |
| 6 | 9 |
| 7 #include "base/bind.h" | 10 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/values.h" | 12 #include "base/values.h" |
| 11 #include "components/prefs/pref_notifier.h" | 13 #include "components/prefs/pref_notifier.h" |
| 12 #include "components/prefs/pref_value_store.h" | |
| 13 #include "components/prefs/testing_pref_store.h" | 14 #include "components/prefs/testing_pref_store.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 using testing::Mock; | 18 using testing::Mock; |
| 18 using testing::_; | 19 using testing::_; |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // Allows to capture pref notifications through gmock. | 23 // Allows to capture pref notifications through gmock. |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 EXPECT_CALL(pref_notifier_, OnPreferenceChanged(name)); | 242 EXPECT_CALL(pref_notifier_, OnPreferenceChanged(name)); |
| 242 EXPECT_CALL(*sync_associator_, ProcessPrefChange(name)); | 243 EXPECT_CALL(*sync_associator_, ProcessPrefChange(name)); |
| 243 } | 244 } |
| 244 | 245 |
| 245 void CheckAndClearValueChangeNotifications() { | 246 void CheckAndClearValueChangeNotifications() { |
| 246 Mock::VerifyAndClearExpectations(&pref_notifier_); | 247 Mock::VerifyAndClearExpectations(&pref_notifier_); |
| 247 Mock::VerifyAndClearExpectations(sync_associator_.get()); | 248 Mock::VerifyAndClearExpectations(sync_associator_.get()); |
| 248 } | 249 } |
| 249 | 250 |
| 250 MockPrefNotifier pref_notifier_; | 251 MockPrefNotifier pref_notifier_; |
| 251 scoped_ptr<MockPrefModelAssociator> sync_associator_; | 252 std::unique_ptr<MockPrefModelAssociator> sync_associator_; |
| 252 scoped_ptr<PrefValueStore> pref_value_store_; | 253 std::unique_ptr<PrefValueStore> pref_value_store_; |
| 253 | 254 |
| 254 scoped_refptr<TestingPrefStore> managed_pref_store_; | 255 scoped_refptr<TestingPrefStore> managed_pref_store_; |
| 255 scoped_refptr<TestingPrefStore> supervised_user_pref_store_; | 256 scoped_refptr<TestingPrefStore> supervised_user_pref_store_; |
| 256 scoped_refptr<TestingPrefStore> extension_pref_store_; | 257 scoped_refptr<TestingPrefStore> extension_pref_store_; |
| 257 scoped_refptr<TestingPrefStore> command_line_pref_store_; | 258 scoped_refptr<TestingPrefStore> command_line_pref_store_; |
| 258 scoped_refptr<TestingPrefStore> user_pref_store_; | 259 scoped_refptr<TestingPrefStore> user_pref_store_; |
| 259 scoped_refptr<TestingPrefStore> recommended_pref_store_; | 260 scoped_refptr<TestingPrefStore> recommended_pref_store_; |
| 260 scoped_refptr<TestingPrefStore> default_pref_store_; | 261 scoped_refptr<TestingPrefStore> default_pref_store_; |
| 261 }; | 262 }; |
| 262 | 263 |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 prefs::kCommandLinePref)); | 662 prefs::kCommandLinePref)); |
| 662 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( | 663 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( |
| 663 prefs::kUserPref)); | 664 prefs::kUserPref)); |
| 664 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( | 665 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( |
| 665 prefs::kRecommendedPref)); | 666 prefs::kRecommendedPref)); |
| 666 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( | 667 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( |
| 667 prefs::kDefaultPref)); | 668 prefs::kDefaultPref)); |
| 668 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( | 669 EXPECT_TRUE(pref_value_store_->PrefValueExtensionModifiable( |
| 669 prefs::kMissingPref)); | 670 prefs::kMissingPref)); |
| 670 } | 671 } |
| OLD | NEW |