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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 #if defined(ENABLE_CONFIGURATION_POLICY) | 24 #if defined(ENABLE_CONFIGURATION_POLICY) |
25 #include "chrome/browser/policy/browser_policy_connector.h" | 25 #include "chrome/browser/policy/browser_policy_connector.h" |
26 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 26 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
27 #include "chrome/browser/policy/policy_map.h" | 27 #include "chrome/browser/policy/policy_map.h" |
28 #include "policy/policy_constants.h" | 28 #include "policy/policy_constants.h" |
29 #endif | 29 #endif |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 using testing::AnyNumber; | |
34 using testing::Return; | 33 using testing::Return; |
35 using testing::_; | 34 using testing::_; |
36 | 35 |
37 class TestSyncProcessorStub : public syncer::SyncChangeProcessor { | 36 class TestSyncProcessorStub : public syncer::SyncChangeProcessor { |
38 virtual syncer::SyncError ProcessSyncChanges( | 37 virtual syncer::SyncError ProcessSyncChanges( |
39 const tracked_objects::Location& from_here, | 38 const tracked_objects::Location& from_here, |
40 const syncer::SyncChangeList& change_list) OVERRIDE { | 39 const syncer::SyncChangeList& change_list) OVERRIDE { |
41 return syncer::SyncError(); | 40 return syncer::SyncError(); |
42 } | 41 } |
43 | 42 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 96 |
98 SyncedPrefChangeRegistrar* registrar() const { | 97 SyncedPrefChangeRegistrar* registrar() const { |
99 return registrar_.get(); | 98 return registrar_.get(); |
100 } | 99 } |
101 | 100 |
102 private: | 101 private: |
103 #if defined(ENABLE_CONFIGURATION_POLICY) | 102 #if defined(ENABLE_CONFIGURATION_POLICY) |
104 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 103 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
105 EXPECT_CALL(policy_provider_, IsInitializationComplete(_)) | 104 EXPECT_CALL(policy_provider_, IsInitializationComplete(_)) |
106 .WillRepeatedly(Return(true)); | 105 .WillRepeatedly(Return(true)); |
107 EXPECT_CALL(policy_provider_, RegisterPolicyDomain(_)).Times(AnyNumber()); | |
108 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( | 106 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( |
109 &policy_provider_); | 107 &policy_provider_); |
110 } | 108 } |
111 #endif | 109 #endif |
112 | 110 |
113 virtual void SetUpOnMainThread() OVERRIDE { | 111 virtual void SetUpOnMainThread() OVERRIDE { |
114 prefs_ = PrefServiceSyncable::FromProfile(browser()->profile()); | 112 prefs_ = PrefServiceSyncable::FromProfile(browser()->profile()); |
115 syncer_ = prefs_->GetSyncableService(syncer::PREFERENCES); | 113 syncer_ = prefs_->GetSyncableService(syncer::PREFERENCES); |
116 syncer_->MergeDataAndStartSyncing( | 114 syncer_->MergeDataAndStartSyncing( |
117 syncer::PREFERENCES, | 115 syncer::PREFERENCES, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 base::Value::CreateBooleanValue(true), | 221 base::Value::CreateBooleanValue(true), |
224 NULL); | 222 NULL); |
225 UpdateChromePolicy(policies); | 223 UpdateChromePolicy(policies); |
226 | 224 |
227 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); | 225 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); |
228 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); | 226 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); |
229 EXPECT_FALSE(observer.has_been_notified); | 227 EXPECT_FALSE(observer.has_been_notified); |
230 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); | 228 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); |
231 } | 229 } |
232 #endif | 230 #endif |
OLD | NEW |