Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/browser/prefs/overlay_user_pref_store_unittest.cc

Issue 9015012: Get rid of trivial IncognitoUserPrefStore and PerTabUserPrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved overlay prefs registration code to prefs_tab_helper Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/values.h" 5 #include "base/values.h"
6 #include "chrome/browser/prefs/overlay_user_pref_store.h" 6 #include "chrome/browser/prefs/overlay_user_pref_store.h"
7 #include "chrome/browser/prefs/testing_pref_store.h" 7 #include "chrome/browser/prefs/testing_pref_store.h"
8 #include "chrome/common/pref_names.h" 8 #include "chrome/common/pref_names.h"
9 #include "chrome/common/pref_store_observer_mock.h" 9 #include "chrome/common/pref_store_observer_mock.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 { 16 namespace {
17 17
18 const char* overlay_key = prefs::kBrowserWindowPlacement; 18 const char* overlay_key = prefs::kBrowserWindowPlacement;
19 const char* regular_key = prefs::kShowBookmarkBar; 19 const char* regular_key = prefs::kShowBookmarkBar;
20 const char* mapped_overlay_key = prefs::kWebKitJavascriptEnabled; 20 const char* mapped_overlay_key = prefs::kWebKitJavascriptEnabled;
21 const char* mapped_underlay_key = prefs::kWebKitGlobalJavascriptEnabled; 21 const char* mapped_underlay_key = prefs::kWebKitGlobalJavascriptEnabled;
22 22
23 } // namespace 23 } // namespace
24 24
25 class OverlayUserPrefStoreTest : public testing::Test { 25 class OverlayUserPrefStoreTest : public testing::Test {
26 protected: 26 protected:
27 OverlayUserPrefStoreTest() 27 OverlayUserPrefStoreTest()
28 : underlay_(new TestingPrefStore()), 28 : underlay_(new TestingPrefStore()),
29 overlay_(new OverlayUserPrefStore(underlay_.get())) { 29 overlay_(new OverlayUserPrefStore(underlay_.get())) {
30 overlay_->RegisterOverlayProperty(overlay_key); 30 overlay_->RegisterOverlayPref(overlay_key);
31 overlay_->RegisterOverlayProperty(mapped_overlay_key, mapped_underlay_key); 31 overlay_->RegisterOverlayPref(mapped_overlay_key, mapped_underlay_key);
32 } 32 }
33 33
34 virtual ~OverlayUserPrefStoreTest() {} 34 virtual ~OverlayUserPrefStoreTest() {}
35 35
36 scoped_refptr<TestingPrefStore> underlay_; 36 scoped_refptr<TestingPrefStore> underlay_;
37 scoped_refptr<OverlayUserPrefStore> overlay_; 37 scoped_refptr<OverlayUserPrefStore> overlay_;
38 }; 38 };
39 39
40 TEST_F(OverlayUserPrefStoreTest, Observer) { 40 TEST_F(OverlayUserPrefStoreTest, Observer) {
41 PrefStoreObserverMock obs; 41 PrefStoreObserverMock obs;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 overlay_->RemoveObserver(&obs); 272 overlay_->RemoveObserver(&obs);
273 273
274 // Check successful unsubscription. 274 // Check successful unsubscription.
275 EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(0); 275 EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_overlay_key))).Times(0);
276 EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_underlay_key))).Times(0); 276 EXPECT_CALL(obs, OnPrefValueChanged(StrEq(mapped_underlay_key))).Times(0);
277 underlay_->SetValue(mapped_underlay_key, Value::CreateIntegerValue(47)); 277 underlay_->SetValue(mapped_underlay_key, Value::CreateIntegerValue(47));
278 overlay_->SetValue(mapped_overlay_key, Value::CreateIntegerValue(48)); 278 overlay_->SetValue(mapped_overlay_key, Value::CreateIntegerValue(48));
279 Mock::VerifyAndClearExpectations(&obs); 279 Mock::VerifyAndClearExpectations(&obs);
280 } 280 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698