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" |
11 #include "chrome/browser/prefs/synced_pref_change_registrar.h" | 11 #include "chrome/browser/prefs/synced_pref_change_registrar.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "chrome/test/base/testing_pref_service_syncable.h" | 15 #include "chrome/test/base/testing_pref_service_syncable.h" |
16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
17 #include "content/public/test/test_utils.h" | 17 #include "content/public/test/test_utils.h" |
| 18 #include "sync/api/attachments/attachment_id.h" |
| 19 #include "sync/api/attachments/attachment_service_proxy_for_test.h" |
18 #include "sync/api/fake_sync_change_processor.h" | 20 #include "sync/api/fake_sync_change_processor.h" |
19 #include "sync/api/sync_change.h" | 21 #include "sync/api/sync_change.h" |
20 #include "sync/api/sync_error_factory.h" | 22 #include "sync/api/sync_error_factory.h" |
21 #include "sync/api/sync_error_factory_mock.h" | 23 #include "sync/api/sync_error_factory_mock.h" |
22 #include "sync/api/syncable_service.h" | 24 #include "sync/api/syncable_service.h" |
23 #include "sync/protocol/sync.pb.h" | 25 #include "sync/protocol/sync.pb.h" |
24 | 26 |
25 #if defined(ENABLE_CONFIGURATION_POLICY) | 27 #if defined(ENABLE_CONFIGURATION_POLICY) |
26 #include "components/policy/core/browser/browser_policy_connector.h" | 28 #include "components/policy/core/browser/browser_policy_connector.h" |
27 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 29 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
(...skipping 25 matching lines...) Expand all Loading... |
53 JSONStringValueSerializer json(&serialized_value); | 55 JSONStringValueSerializer json(&serialized_value); |
54 json.Serialize(base::FundamentalValue(value)); | 56 json.Serialize(base::FundamentalValue(value)); |
55 | 57 |
56 sync_pb::EntitySpecifics specifics; | 58 sync_pb::EntitySpecifics specifics; |
57 sync_pb::PreferenceSpecifics* pref_specifics = | 59 sync_pb::PreferenceSpecifics* pref_specifics = |
58 specifics.mutable_preference(); | 60 specifics.mutable_preference(); |
59 pref_specifics->set_name(name); | 61 pref_specifics->set_name(name); |
60 pref_specifics->set_value(serialized_value); | 62 pref_specifics->set_value(serialized_value); |
61 | 63 |
62 syncer::SyncData change_data = syncer::SyncData::CreateRemoteData( | 64 syncer::SyncData change_data = syncer::SyncData::CreateRemoteData( |
63 ++next_sync_data_id_, specifics, base::Time()); | 65 ++next_sync_data_id_, |
| 66 specifics, |
| 67 base::Time(), |
| 68 syncer::AttachmentIdList(), |
| 69 syncer::AttachmentServiceProxyForTest::Create()); |
64 syncer::SyncChange change( | 70 syncer::SyncChange change( |
65 FROM_HERE, syncer::SyncChange::ACTION_UPDATE, change_data); | 71 FROM_HERE, syncer::SyncChange::ACTION_UPDATE, change_data); |
66 | 72 |
67 syncer::SyncChangeList change_list; | 73 syncer::SyncChangeList change_list; |
68 change_list.push_back(change); | 74 change_list.push_back(change); |
69 | 75 |
70 syncer_->ProcessSyncChanges(FROM_HERE, change_list); | 76 syncer_->ProcessSyncChanges(FROM_HERE, change_list); |
71 } | 77 } |
72 | 78 |
73 void SetBooleanPrefValueFromLocal(const std::string& name, bool value) { | 79 void SetBooleanPrefValueFromLocal(const std::string& name, bool value) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 base::Value::CreateBooleanValue(true), | 216 base::Value::CreateBooleanValue(true), |
211 NULL); | 217 NULL); |
212 UpdateChromePolicy(policies); | 218 UpdateChromePolicy(policies); |
213 | 219 |
214 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); | 220 EXPECT_TRUE(prefs()->IsManagedPreference(prefs::kShowHomeButton)); |
215 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); | 221 SetBooleanPrefValueFromSync(prefs::kShowHomeButton, false); |
216 EXPECT_FALSE(observer.has_been_notified); | 222 EXPECT_FALSE(observer.has_been_notified); |
217 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); | 223 EXPECT_TRUE(GetBooleanPrefValue(prefs::kShowHomeButton)); |
218 } | 224 } |
219 #endif | 225 #endif |
OLD | NEW |