diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 09:49:11 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 09:49:11 +0000 |
commit | acd78969cf6569dcbf409dceb0b6511751afd026 (patch) | |
tree | ed2168c663ae3e8a15d857838b78ed2386da3281 /chrome/common/pref_store_observer_mock.h | |
parent | 5138bbffd1b2d5151ad74b4e7ae8091fc7d44114 (diff) | |
download | chromium_src-acd78969cf6569dcbf409dceb0b6511751afd026.zip chromium_src-acd78969cf6569dcbf409dceb0b6511751afd026.tar.gz chromium_src-acd78969cf6569dcbf409dceb0b6511751afd026.tar.bz2 |
Clean up pref change notification handling.
This is a complete overhaul of PrefValueStore, PrefStore, PrefNotifier, and PrefService. Specifically:
- Add an observer interface to PrefStore that can be used to notify the upper layers of the pref system about value changes. Currently, it's unused mostly, but that'll change when we refactor ExtensionPrefStore and ConfigurationPolicyPrefStore.
- Make PrefNotifier be a dependency of PrefValueStore. That helps in keeping the pref change detection handling local to PrefValueStore.
- Clean up related unit tests, removing redundant mocks and gmockify others.
BUG=64893
TEST=Compiles and passes tests
Review URL: http://codereview.chromium.org/5441002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68574 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/pref_store_observer_mock.h')
-rw-r--r-- | chrome/common/pref_store_observer_mock.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/common/pref_store_observer_mock.h b/chrome/common/pref_store_observer_mock.h new file mode 100644 index 0000000..72e27a1 --- /dev/null +++ b/chrome/common/pref_store_observer_mock.h @@ -0,0 +1,26 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_PREF_STORE_OBSERVER_MOCK_H_ +#define CHROME_COMMON_PREF_STORE_OBSERVER_MOCK_H_ +#pragma once + +#include "base/basictypes.h" +#include "chrome/common/pref_store.h" +#include "testing/gmock/include/gmock/gmock.h" + +// A gmock-ified implementation of PrefStore::ObserverInterface. +class PrefStoreObserverMock : public PrefStore::ObserverInterface { + public: + PrefStoreObserverMock() {} + virtual ~PrefStoreObserverMock() {} + + MOCK_METHOD1(OnPrefValueChanged, void(const std::string&)); + MOCK_METHOD0(OnInitializationCompleted, void()); + + private: + DISALLOW_COPY_AND_ASSIGN(PrefStoreObserverMock); +}; + +#endif // CHROME_COMMON_PREF_STORE_OBSERVER_MOCK_H_ |