OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 PrefServiceSyncable* prefs() const { | 87 PrefServiceSyncable* prefs() const { |
88 return prefs_; | 88 return prefs_; |
89 } | 89 } |
90 | 90 |
91 SyncedPrefChangeRegistrar* registrar() const { | 91 SyncedPrefChangeRegistrar* registrar() const { |
92 return registrar_.get(); | 92 return registrar_.get(); |
93 } | 93 } |
94 | 94 |
95 private: | 95 private: |
96 #if defined(ENABLE_CONFIGURATION_POLICY) | 96 #if defined(ENABLE_CONFIGURATION_POLICY) |
97 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 97 virtual void SetUpInProcessBrowserTestFixture() override { |
98 EXPECT_CALL(policy_provider_, IsInitializationComplete(_)) | 98 EXPECT_CALL(policy_provider_, IsInitializationComplete(_)) |
99 .WillRepeatedly(Return(true)); | 99 .WillRepeatedly(Return(true)); |
100 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( | 100 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( |
101 &policy_provider_); | 101 &policy_provider_); |
102 } | 102 } |
103 #endif | 103 #endif |
104 | 104 |
105 virtual void SetUpOnMainThread() OVERRIDE { | 105 virtual void SetUpOnMainThread() override { |
106 prefs_ = PrefServiceSyncable::FromProfile(browser()->profile()); | 106 prefs_ = PrefServiceSyncable::FromProfile(browser()->profile()); |
107 syncer_ = prefs_->GetSyncableService(syncer::PREFERENCES); | 107 syncer_ = prefs_->GetSyncableService(syncer::PREFERENCES); |
108 syncer_->MergeDataAndStartSyncing( | 108 syncer_->MergeDataAndStartSyncing( |
109 syncer::PREFERENCES, | 109 syncer::PREFERENCES, |
110 syncer::SyncDataList(), | 110 syncer::SyncDataList(), |
111 scoped_ptr<syncer::SyncChangeProcessor>( | 111 scoped_ptr<syncer::SyncChangeProcessor>( |
112 new syncer::FakeSyncChangeProcessor), | 112 new syncer::FakeSyncChangeProcessor), |
113 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock)); | 113 scoped_ptr<syncer::SyncErrorFactory>(new syncer::SyncErrorFactoryMock)); |
114 registrar_.reset(new SyncedPrefChangeRegistrar(prefs_)); | 114 registrar_.reset(new SyncedPrefChangeRegistrar(prefs_)); |
115 } | 115 } |
116 | 116 |
117 virtual void TearDownOnMainThread() OVERRIDE { | 117 virtual void TearDownOnMainThread() override { |
118 registrar_.reset(); | 118 registrar_.reset(); |
119 } | 119 } |
120 | 120 |
121 PrefServiceSyncable* prefs_; | 121 PrefServiceSyncable* prefs_; |
122 syncer::SyncableService* syncer_; | 122 syncer::SyncableService* syncer_; |
123 int next_sync_data_id_; | 123 int next_sync_data_id_; |
124 | 124 |
125 scoped_ptr<SyncedPrefChangeRegistrar> registrar_; | 125 scoped_ptr<SyncedPrefChangeRegistrar> registrar_; |
126 #if defined(ENABLE_CONFIGURATION_POLICY) | 126 #if defined(ENABLE_CONFIGURATION_POLICY) |
127 policy::MockConfigurationPolicyProvider policy_provider_; | 127 policy::MockConfigurationPolicyProvider policy_provider_; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 new base::FundamentalValue(true), | 216 new base::FundamentalValue(true), |
217 NULL); | 217 NULL); |
218 UpdateChromePolicy(policies); | 218 UpdateChromePolicy(policies); |
219 | 219 |
220 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); | 220 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); |
221 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); | 221 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); |
222 EXPECT_FALSE(observer.has_been_notified); | 222 EXPECT_FALSE(observer.has_been_notified); |
223 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); | 223 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); |
224 } | 224 } |
225 #endif | 225 #endif |
OLD | NEW |