[email protected] | 3339229 | 2011-01-05 17:56:39 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
brettw | f00b9b4 | 2016-02-01 22:11:38 | [diff] [blame] | 5 | #include "components/prefs/pref_store_observer_mock.h" |
[email protected] | 3339229 | 2011-01-05 17:56:39 | [diff] [blame] | 6 | |
[email protected] | b90439b | 2014-03-28 16:17:41 | [diff] [blame] | 7 | #include "testing/gtest/include/gtest/gtest.h" |
| 8 | |
| 9 | PrefStoreObserverMock::PrefStoreObserverMock() |
| 10 | : initialized(false), initialization_success(false) {} |
[email protected] | 3339229 | 2011-01-05 17:56:39 | [diff] [blame] | 11 | |
| 12 | PrefStoreObserverMock::~PrefStoreObserverMock() {} |
[email protected] | b90439b | 2014-03-28 16:17:41 | [diff] [blame] | 13 | |
| 14 | void PrefStoreObserverMock::VerifyAndResetChangedKey( |
| 15 | const std::string& expected) { |
| 16 | EXPECT_EQ(1u, changed_keys.size()); |
| 17 | if (changed_keys.size() >= 1) |
| 18 | EXPECT_EQ(expected, changed_keys.front()); |
| 19 | changed_keys.clear(); |
| 20 | } |
| 21 | |
| 22 | void PrefStoreObserverMock::OnPrefValueChanged(const std::string& key) { |
| 23 | changed_keys.push_back(key); |
| 24 | } |
| 25 | |
| 26 | void PrefStoreObserverMock::OnInitializationCompleted(bool success) { |
| 27 | initialized = true; |
| 28 | initialization_success = success; |
| 29 | } |