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

Side by Side Diff: components/syncable_prefs/pref_service_syncable_unittest.cc

Issue 1549993003: Switch to standard integer types in components/, part 4 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/syncable_prefs/pref_service_syncable.h" 5 #include "components/syncable_prefs/pref_service_syncable.h"
6 6
7 #include <stdint.h>
8
7 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
8 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
9 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
11 #include "base/prefs/scoped_user_pref_update.h" 14 #include "base/prefs/scoped_user_pref_update.h"
12 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
13 #include "components/pref_registry/pref_registry_syncable.h" 16 #include "components/pref_registry/pref_registry_syncable.h"
14 #include "components/syncable_prefs/pref_model_associator.h" 17 #include "components/syncable_prefs/pref_model_associator.h"
15 #include "components/syncable_prefs/pref_model_associator_client.h" 18 #include "components/syncable_prefs/pref_model_associator_client.h"
16 #include "components/syncable_prefs/testing_pref_service_syncable.h" 19 #include "components/syncable_prefs/testing_pref_service_syncable.h"
17 #include "sync/api/attachments/attachment_id.h" 20 #include "sync/api/attachments/attachment_id.h"
18 #include "sync/api/sync_change.h" 21 #include "sync/api/sync_change.h"
19 #include "sync/api/sync_data.h" 22 #include "sync/api/sync_data.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 kDefaultCharsetPrefName, 116 kDefaultCharsetPrefName,
114 kDefaultCharsetValue, 117 kDefaultCharsetValue,
115 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 118 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
116 119
117 pref_sync_service_ = reinterpret_cast<PrefModelAssociator*>( 120 pref_sync_service_ = reinterpret_cast<PrefModelAssociator*>(
118 prefs_.GetSyncableService(syncer::PREFERENCES)); 121 prefs_.GetSyncableService(syncer::PREFERENCES));
119 ASSERT_TRUE(pref_sync_service_); 122 ASSERT_TRUE(pref_sync_service_);
120 next_pref_remote_sync_node_id_ = 0; 123 next_pref_remote_sync_node_id_ = 0;
121 } 124 }
122 125
123 syncer::SyncChange MakeRemoteChange( 126 syncer::SyncChange MakeRemoteChange(int64_t id,
124 int64 id, 127 const std::string& name,
125 const std::string& name, 128 const base::Value& value,
126 const base::Value& value, 129 SyncChange::SyncChangeType type) {
127 SyncChange::SyncChangeType type) {
128 std::string serialized; 130 std::string serialized;
129 JSONStringValueSerializer json(&serialized); 131 JSONStringValueSerializer json(&serialized);
130 if (!json.Serialize(value)) 132 if (!json.Serialize(value))
131 return syncer::SyncChange(); 133 return syncer::SyncChange();
132 sync_pb::EntitySpecifics entity; 134 sync_pb::EntitySpecifics entity;
133 sync_pb::PreferenceSpecifics* pref_one = entity.mutable_preference(); 135 sync_pb::PreferenceSpecifics* pref_one = entity.mutable_preference();
134 pref_one->set_name(name); 136 pref_one->set_name(name);
135 pref_one->set_value(serialized); 137 pref_one->set_value(serialized);
136 return syncer::SyncChange( 138 return syncer::SyncChange(
137 FROM_HERE, 139 FROM_HERE,
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 syncer::SyncChangeList list; 553 syncer::SyncChangeList list;
552 list.push_back(MakeRemoteChange( 554 list.push_back(MakeRemoteChange(
553 1, kStringPrefName, *null_value, SyncChange::ACTION_DELETE)); 555 1, kStringPrefName, *null_value, SyncChange::ACTION_DELETE));
554 pref_sync_service_->ProcessSyncChanges(FROM_HERE, list); 556 pref_sync_service_->ProcessSyncChanges(FROM_HERE, list);
555 EXPECT_TRUE(pref->IsDefaultValue()); 557 EXPECT_TRUE(pref->IsDefaultValue());
556 } 558 }
557 559
558 } // namespace 560 } // namespace
559 561
560 } // namespace syncable_prefs 562 } // namespace syncable_prefs
OLDNEW
« no previous file with comments | « components/syncable_prefs/pref_service_syncable_factory.h ('k') | components/syncable_prefs/synced_pref_change_registrar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698