1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PREFS_PREF_STORE_OBSERVER_MOCK_H_
6 #define COMPONENTS_PREFS_PREF_STORE_OBSERVER_MOCK_H_
11 #include "base/compiler_specific.h"
12 #include "components/prefs/pref_store.h"
14 // A mock implementation of PrefStore::Observer.
15 class PrefStoreObserverMock : public PrefStore::Observer {
17 PrefStoreObserverMock();
19 PrefStoreObserverMock(const PrefStoreObserverMock&) = delete;
20 PrefStoreObserverMock& operator=(const PrefStoreObserverMock&) = delete;
22 ~PrefStoreObserverMock() override;
24 void VerifyAndResetChangedKey(const std::string& expected);
26 // PrefStore::Observer implementation
27 void OnPrefValueChanged(const std::string& key) override;
28 void OnInitializationCompleted(bool success) override;
30 std::vector<std::string> changed_keys;
32 bool initialization_success; // Only valid if |initialized|.
35 #endif // COMPONENTS_PREFS_PREF_STORE_OBSERVER_MOCK_H_