| OLD | NEW | 
|---|
| 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 "chrome/browser/prefs/pref_notifier_impl.h" | 5 #include "chrome/browser/prefs/pref_notifier_impl.h" | 
| 6 #include "chrome/browser/prefs/pref_observer_mock.h" | 6 #include "chrome/browser/prefs/pref_observer_mock.h" | 
| 7 #include "chrome/browser/prefs/pref_service.h" | 7 #include "chrome/browser/prefs/pref_service.h" | 
| 8 #include "chrome/browser/prefs/pref_value_store.h" | 8 #include "chrome/browser/prefs/pref_value_store.h" | 
| 9 #include "chrome/test/testing_pref_service.h" | 9 #include "chrome/test/testing_pref_service.h" | 
| 10 #include "content/common/notification_observer_mock.h" | 10 #include "content/common/notification_observer_mock.h" | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 49     } | 49     } | 
| 50 | 50 | 
| 51     return count; | 51     return count; | 
| 52   } | 52   } | 
| 53 }; | 53 }; | 
| 54 | 54 | 
| 55 // Test fixture class. | 55 // Test fixture class. | 
| 56 class PrefNotifierTest : public testing::Test { | 56 class PrefNotifierTest : public testing::Test { | 
| 57  protected: | 57  protected: | 
| 58   virtual void SetUp() { | 58   virtual void SetUp() { | 
| 59     pref_service_.RegisterBooleanPref(kChangedPref, true); | 59     pref_service_.RegisterBooleanPref(kChangedPref, | 
| 60     pref_service_.RegisterBooleanPref(kUnchangedPref, true); | 60                                       true, | 
|  | 61                                       false /* don't sync pref */); | 
|  | 62     pref_service_.RegisterBooleanPref(kUnchangedPref, | 
|  | 63                                       true, | 
|  | 64                                       false /* don't sync pref */); | 
| 61   } | 65   } | 
| 62 | 66 | 
| 63   TestingPrefService pref_service_; | 67   TestingPrefService pref_service_; | 
| 64 | 68 | 
| 65   PrefObserverMock obs1_; | 69   PrefObserverMock obs1_; | 
| 66   PrefObserverMock obs2_; | 70   PrefObserverMock obs2_; | 
| 67 }; | 71 }; | 
| 68 | 72 | 
| 69 TEST_F(PrefNotifierTest, OnPreferenceChanged) { | 73 TEST_F(PrefNotifierTest, OnPreferenceChanged) { | 
| 70   MockPrefNotifier notifier(&pref_service_); | 74   MockPrefNotifier notifier(&pref_service_); | 
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 186   obs2_.Expect(&pref_service_, kChangedPref, &value_true); | 190   obs2_.Expect(&pref_service_, kChangedPref, &value_true); | 
| 187   notifier.OnPreferenceChanged(kChangedPref); | 191   notifier.OnPreferenceChanged(kChangedPref); | 
| 188   Mock::VerifyAndClearExpectations(&obs1_); | 192   Mock::VerifyAndClearExpectations(&obs1_); | 
| 189   Mock::VerifyAndClearExpectations(&obs2_); | 193   Mock::VerifyAndClearExpectations(&obs2_); | 
| 190 | 194 | 
| 191   notifier.RemovePrefObserver(kChangedPref, &obs2_); | 195   notifier.RemovePrefObserver(kChangedPref, &obs2_); | 
| 192   notifier.RemovePrefObserver(kUnchangedPref, &obs2_); | 196   notifier.RemovePrefObserver(kUnchangedPref, &obs2_); | 
| 193 } | 197 } | 
| 194 | 198 | 
| 195 }  // namespace | 199 }  // namespace | 
| OLD | NEW | 
|---|