| 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" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 using ::testing::Mock; | 13 using ::testing::Mock; |
| 14 using ::testing::StrEq; | 14 using ::testing::StrEq; |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 const char kBrowserWindowPlacement[] = "browser.window_placement"; | 19 const char kBrowserWindowPlacement[] = "browser.window_placement"; |
| 20 const char kShowBookmarkBar[] = "bookmark_bar.show_on_all_tabs"; | 20 const char kShowBookmarkBar[] = "bookmark_bar.show_on_all_tabs"; |
| 21 | 21 |
| 22 const char* overlay_key = kBrowserWindowPlacement; | 22 const char* const overlay_key = kBrowserWindowPlacement; |
| 23 const char* regular_key = kShowBookmarkBar; | 23 const char* const regular_key = kShowBookmarkBar; |
| 24 // With the removal of the kWebKitGlobalXXX prefs, we'll no longer have real | 24 // With the removal of the kWebKitGlobalXXX prefs, we'll no longer have real |
| 25 // prefs using the overlay pref store, so make up keys here. | 25 // prefs using the overlay pref store, so make up keys here. |
| 26 const char* mapped_overlay_key = "test.per_tab.javascript_enabled"; | 26 const char mapped_overlay_key[] = "test.per_tab.javascript_enabled"; |
| 27 const char* mapped_underlay_key = "test.per_profile.javascript_enabled"; | 27 const char mapped_underlay_key[] = "test.per_profile.javascript_enabled"; |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 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); |
| (...skipping 207 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 |