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

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

Issue 4876002: Create additional PrefStore for Device Management policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review feedback Created 10 years, 1 month 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
« no previous file with comments | « chrome/browser/prefs/pref_notifier.h ('k') | chrome/browser/prefs/pref_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
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, new DefaultPrefStore()) {} 64 : PrefValueStore(NULL, NULL, NULL, NULL, NULL, NULL,
65 new DefaultPrefStore()) {}
65 66
66 virtual ~MockPrefValueStore() {} 67 virtual ~MockPrefValueStore() {}
67 68
68 // 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".
69 virtual bool PrefHasChanged(const char* path, 70 virtual bool PrefHasChanged(const char* path,
70 PrefNotifier::PrefStoreType new_store) { 71 PrefNotifier::PrefStoreType new_store) {
71 std::string path_str(path); 72 std::string path_str(path);
72 if (path_str.compare(0, 7, "changed") == 0) 73 if (path_str.compare(0, 7, "changed") == 0)
73 return true; 74 return true;
74 return false; 75 return false;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 285
285 EXPECT_CALL(obs1_, Observe(_, _, _)).Times(0); 286 EXPECT_CALL(obs1_, Observe(_, _, _)).Times(0);
286 EXPECT_CALL(obs2_, Observe(_, _, _)).Times(0); 287 EXPECT_CALL(obs2_, Observe(_, _, _)).Times(0);
287 notifier_->OnUserPreferenceSet(kUnchangedPref); 288 notifier_->OnUserPreferenceSet(kUnchangedPref);
288 289
289 notifier_->RemovePrefObserver(kChangedPref, &obs2_); 290 notifier_->RemovePrefObserver(kChangedPref, &obs2_);
290 notifier_->RemovePrefObserver(kUnchangedPref, &obs2_); 291 notifier_->RemovePrefObserver(kUnchangedPref, &obs2_);
291 } 292 }
292 293
293 } // namespace 294 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_notifier.h ('k') | chrome/browser/prefs/pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698