OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/default_pref_store.h" | 5 #include "chrome/browser/prefs/default_pref_store.h" |
6 #include "chrome/browser/prefs/pref_notifier.h" | 6 #include "chrome/browser/prefs/pref_notifier.h" |
7 #include "chrome/browser/prefs/pref_service.h" | 7 #include "chrome/browser/prefs/pref_service.h" |
8 #include "chrome/browser/prefs/pref_value_store.h" | 8 #include "chrome/browser/prefs/pref_value_store.h" |
9 #include "chrome/common/notification_observer.h" | 9 #include "chrome/common/notification_observer.h" |
10 #include "chrome/common/notification_type.h" | 10 #include "chrome/common/notification_type.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return count; | 55 return count; |
56 } | 56 } |
57 }; | 57 }; |
58 | 58 |
59 // Mock PrefValueStore that has no unnecessary PrefStores and injects a simpler | 59 // Mock PrefValueStore that has no unnecessary PrefStores and injects a simpler |
60 // PrefHasChanged(). | 60 // PrefHasChanged(). |
61 class MockPrefValueStore : public PrefValueStore { | 61 class MockPrefValueStore : public PrefValueStore { |
62 public: | 62 public: |
63 MockPrefValueStore() | 63 MockPrefValueStore() |
64 : PrefValueStore(NULL, NULL, NULL, NULL, NULL, NULL, | 64 : PrefValueStore(NULL, NULL, NULL, NULL, NULL, NULL, |
65 new DefaultPrefStore()) {} | 65 new DefaultPrefStore(), NULL) {} |
66 | 66 |
67 virtual ~MockPrefValueStore() {} | 67 virtual ~MockPrefValueStore() {} |
68 | 68 |
69 // This mock version returns true if the pref path starts with "changed". | 69 // This mock version returns true if the pref path starts with "changed". |
70 virtual bool PrefHasChanged(const char* path, | 70 virtual bool PrefHasChanged(const char* path, |
71 PrefNotifier::PrefStoreType new_store) { | 71 PrefNotifier::PrefStoreType new_store) { |
72 std::string path_str(path); | 72 std::string path_str(path); |
73 if (path_str.compare(0, 7, "changed") == 0) | 73 if (path_str.compare(0, 7, "changed") == 0) |
74 return true; | 74 return true; |
75 return false; | 75 return false; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 EXPECT_CALL(obs1_, Observe(_, _, _)).Times(0); | 286 EXPECT_CALL(obs1_, Observe(_, _, _)).Times(0); |
287 EXPECT_CALL(obs2_, Observe(_, _, _)).Times(0); | 287 EXPECT_CALL(obs2_, Observe(_, _, _)).Times(0); |
288 notifier_->OnUserPreferenceSet(kUnchangedPref); | 288 notifier_->OnUserPreferenceSet(kUnchangedPref); |
289 | 289 |
290 notifier_->RemovePrefObserver(kChangedPref, &obs2_); | 290 notifier_->RemovePrefObserver(kChangedPref, &obs2_); |
291 notifier_->RemovePrefObserver(kUnchangedPref, &obs2_); | 291 notifier_->RemovePrefObserver(kUnchangedPref, &obs2_); |
292 } | 292 } |
293 | 293 |
294 } // namespace | 294 } // namespace |
OLD | NEW |