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

Side by Side Diff: chrome/browser/prefs/pref_notifier_unittest.cc

Issue 5204006: Renamed DefaultPrefStore into InMemoryPrefStore because it can be used in further contexts. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased Created 10 years 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 | Annotate | Revision Log
OLDNEW
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/in_memory_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"
11 #include "chrome/common/notification_service.h" 11 #include "chrome/common/notification_service.h"
12 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 15
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(), NULL) {} 65 new InMemoryPrefStore(), 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
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
OLDNEW
« no previous file with comments | « chrome/browser/prefs/in_memory_pref_store.cc ('k') | chrome/browser/prefs/pref_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698