OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/prefs/overlay_user_pref_store.h" | 5 #include "base/prefs/overlay_user_pref_store.h" |
6 | 6 |
7 #include "base/prefs/pref_store_observer_mock.h" | 7 #include "base/prefs/pref_store_observer_mock.h" |
8 #include "base/prefs/testing_pref_store.h" | 8 #include "base/prefs/testing_pref_store.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 class OverlayUserPrefStoreTest : public testing::Test { | 31 class OverlayUserPrefStoreTest : public testing::Test { |
32 protected: | 32 protected: |
33 OverlayUserPrefStoreTest() | 33 OverlayUserPrefStoreTest() |
34 : underlay_(new TestingPrefStore()), | 34 : underlay_(new TestingPrefStore()), |
35 overlay_(new OverlayUserPrefStore(underlay_.get())) { | 35 overlay_(new OverlayUserPrefStore(underlay_.get())) { |
36 overlay_->RegisterOverlayPref(overlay_key); | 36 overlay_->RegisterOverlayPref(overlay_key); |
37 overlay_->RegisterOverlayPref(mapped_overlay_key, mapped_underlay_key); | 37 overlay_->RegisterOverlayPref(mapped_overlay_key, mapped_underlay_key); |
38 } | 38 } |
39 | 39 |
40 virtual ~OverlayUserPrefStoreTest() {} | 40 ~OverlayUserPrefStoreTest() override {} |
41 | 41 |
42 scoped_refptr<TestingPrefStore> underlay_; | 42 scoped_refptr<TestingPrefStore> underlay_; |
43 scoped_refptr<OverlayUserPrefStore> overlay_; | 43 scoped_refptr<OverlayUserPrefStore> overlay_; |
44 }; | 44 }; |
45 | 45 |
46 TEST_F(OverlayUserPrefStoreTest, Observer) { | 46 TEST_F(OverlayUserPrefStoreTest, Observer) { |
47 PrefStoreObserverMock obs; | 47 PrefStoreObserverMock obs; |
48 overlay_->AddObserver(&obs); | 48 overlay_->AddObserver(&obs); |
49 | 49 |
50 // Check that underlay first value is reported. | 50 // Check that underlay first value is reported. |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 245 |
246 overlay_->RemoveObserver(&obs); | 246 overlay_->RemoveObserver(&obs); |
247 | 247 |
248 // Check successful unsubscription. | 248 // Check successful unsubscription. |
249 underlay_->SetValue(mapped_underlay_key, new FundamentalValue(47)); | 249 underlay_->SetValue(mapped_underlay_key, new FundamentalValue(47)); |
250 overlay_->SetValue(mapped_overlay_key, new FundamentalValue(48)); | 250 overlay_->SetValue(mapped_overlay_key, new FundamentalValue(48)); |
251 EXPECT_TRUE(obs.changed_keys.empty()); | 251 EXPECT_TRUE(obs.changed_keys.empty()); |
252 } | 252 } |
253 | 253 |
254 } // namespace base | 254 } // namespace base |
OLD | NEW |