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

Side by Side Diff: base/prefs/pref_store_observer_mock.h

Issue 210063003: Refactor TestingPrefStore to make it useful to some tests of load errors and asynchrony. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adopt a non-gmock approach in the clients. Created 6 years, 9 months 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_PREFS_PREF_STORE_OBSERVER_MOCK_H_ 5 #ifndef BASE_PREFS_PREF_STORE_OBSERVER_MOCK_H_
6 #define BASE_PREFS_PREF_STORE_OBSERVER_MOCK_H_ 6 #define BASE_PREFS_PREF_STORE_OBSERVER_MOCK_H_
7 7
8 #include "base/basictypes.h" 8 #include <string>
9 #include <vector>
10
11 #include "base/compiler_specific.h"
12 #include "base/macros.h"
9 #include "base/prefs/pref_store.h" 13 #include "base/prefs/pref_store.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11 14
12 // A gmock-ified implementation of PrefStore::Observer. 15 // A mock implementation of PrefStore::Observer.
13 class PrefStoreObserverMock : public PrefStore::Observer { 16 class PrefStoreObserverMock : public PrefStore::Observer {
14 public: 17 public:
15 PrefStoreObserverMock(); 18 PrefStoreObserverMock();
16 virtual ~PrefStoreObserverMock(); 19 virtual ~PrefStoreObserverMock();
17 20
18 MOCK_METHOD1(OnPrefValueChanged, void(const std::string&)); 21 // PrefStore::Observer implementation
19 MOCK_METHOD1(OnInitializationCompleted, void(bool)); 22 virtual void OnPrefValueChanged(const std::string& key) OVERRIDE;
23 virtual void OnInitializationCompleted(bool success) OVERRIDE;
24
25 std::vector<std::string> changed_keys;
26 bool initialized;
27 bool initialization_success; // Only valid if |initialized|.
20 28
21 private: 29 private:
22 DISALLOW_COPY_AND_ASSIGN(PrefStoreObserverMock); 30 DISALLOW_COPY_AND_ASSIGN(PrefStoreObserverMock);
23 }; 31 };
24 32
25 #endif // BASE_PREFS_PREF_STORE_OBSERVER_MOCK_H_ 33 #endif // BASE_PREFS_PREF_STORE_OBSERVER_MOCK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698