blob: 630ac708aec1fe067343febf67841195694c3215 [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2011 The Chromium Authors
brettw58cd1f12016-01-30 05:56:052// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
brettw066508682016-02-03 08:22:025#ifndef COMPONENTS_PREFS_PREF_STORE_OBSERVER_MOCK_H_
6#define COMPONENTS_PREFS_PREF_STORE_OBSERVER_MOCK_H_
brettw58cd1f12016-01-30 05:56:057
Jan Keitel0523c5e32024-06-28 13:58:528#include <string_view>
brettw58cd1f12016-01-30 05:56:059#include <vector>
10
11#include "base/compiler_specific.h"
brettwf00b9b42016-02-01 22:11:3812#include "components/prefs/pref_store.h"
brettw58cd1f12016-01-30 05:56:0513
14// A mock implementation of PrefStore::Observer.
15class PrefStoreObserverMock : public PrefStore::Observer {
16 public:
17 PrefStoreObserverMock();
Peter Boström09c01822021-09-20 22:43:2718
19 PrefStoreObserverMock(const PrefStoreObserverMock&) = delete;
20 PrefStoreObserverMock& operator=(const PrefStoreObserverMock&) = delete;
21
brettw58cd1f12016-01-30 05:56:0522 ~PrefStoreObserverMock() override;
23
24 void VerifyAndResetChangedKey(const std::string& expected);
25
26 // PrefStore::Observer implementation
Jan Keitel0523c5e32024-06-28 13:58:5227 void OnPrefValueChanged(std::string_view key) override;
brettw58cd1f12016-01-30 05:56:0528 void OnInitializationCompleted(bool success) override;
29
30 std::vector<std::string> changed_keys;
31 bool initialized;
32 bool initialization_success; // Only valid if |initialized|.
brettw58cd1f12016-01-30 05:56:0533};
34
brettw066508682016-02-03 08:22:0235#endif // COMPONENTS_PREFS_PREF_STORE_OBSERVER_MOCK_H_