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

Side by Side Diff: components/sync/engine_impl/apply_control_data_updates_unittest.cc

Issue 2427803002: [Sync] Replacing NULL with nullptr in code and null in comments for components/sync/ (Closed)
Patch Set: Fixing start of sentence capitlization. Created 4 years, 2 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/sync/engine_impl/apply_control_data_updates.h" 5 #include "components/sync/engine_impl/apply_control_data_updates.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 Syncer::UnsyncedMetaHandles handles; 127 Syncer::UnsyncedMetaHandles handles;
128 GetUnsyncedEntries(&trans, &handles); 128 GetUnsyncedEntries(&trans, &handles);
129 EXPECT_TRUE(handles.empty()); 129 EXPECT_TRUE(handles.empty());
130 } 130 }
131 131
132 // Create unsynced bookmarks without encryption. 132 // Create unsynced bookmarks without encryption.
133 // First item is a folder 133 // First item is a folder
134 Id folder_id = id_factory_.NewLocalId(); 134 Id folder_id = id_factory_.NewLocalId();
135 entry_factory_->CreateUnsyncedItem(folder_id, id_factory_.root(), "folder", 135 entry_factory_->CreateUnsyncedItem(folder_id, id_factory_.root(), "folder",
136 true, BOOKMARKS, NULL); 136 true, BOOKMARKS, nullptr);
137 // Next five items are children of the folder 137 // Next five items are children of the folder
138 size_t i; 138 size_t i;
139 size_t batch_s = 5; 139 size_t batch_s = 5;
140 for (i = 0; i < batch_s; ++i) { 140 for (i = 0; i < batch_s; ++i) {
141 entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id, 141 entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id,
142 base::StringPrintf("Item %" PRIuS "", i), 142 base::StringPrintf("Item %" PRIuS "", i),
143 false, BOOKMARKS, NULL); 143 false, BOOKMARKS, nullptr);
144 } 144 }
145 // Next five items are children of the root. 145 // Next five items are children of the root.
146 for (; i < 2 * batch_s; ++i) { 146 for (; i < 2 * batch_s; ++i) {
147 entry_factory_->CreateUnsyncedItem( 147 entry_factory_->CreateUnsyncedItem(
148 id_factory_.NewLocalId(), id_factory_.root(), 148 id_factory_.NewLocalId(), id_factory_.root(),
149 base::StringPrintf("Item %" PRIuS "", i), false, BOOKMARKS, NULL); 149 base::StringPrintf("Item %" PRIuS "", i), false, BOOKMARKS, nullptr);
150 } 150 }
151 151
152 KeyParams params = {"localhost", "dummy", "foobar"}; 152 KeyParams params = {"localhost", "dummy", "foobar"};
153 cryptographer->AddKey(params); 153 cryptographer->AddKey(params);
154 sync_pb::EntitySpecifics specifics; 154 sync_pb::EntitySpecifics specifics;
155 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); 155 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
156 cryptographer->GetKeys(nigori->mutable_encryption_keybag()); 156 cryptographer->GetKeys(nigori->mutable_encryption_keybag());
157 nigori->set_encrypt_everything(true); 157 nigori->set_encrypt_everything(true);
158 encrypted_types.Put(BOOKMARKS); 158 encrypted_types.Put(BOOKMARKS);
159 entry_factory_->CreateUnappliedNewItem(ModelTypeToRootTag(NIGORI), specifics, 159 entry_factory_->CreateUnappliedNewItem(ModelTypeToRootTag(NIGORI), specifics,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 Syncer::UnsyncedMetaHandles handles; 238 Syncer::UnsyncedMetaHandles handles;
239 GetUnsyncedEntries(&trans, &handles); 239 GetUnsyncedEntries(&trans, &handles);
240 EXPECT_TRUE(handles.empty()); 240 EXPECT_TRUE(handles.empty());
241 } 241 }
242 242
243 // Create unsynced bookmarks without encryption. 243 // Create unsynced bookmarks without encryption.
244 // First item is a folder 244 // First item is a folder
245 Id folder_id = id_factory_.NewLocalId(); 245 Id folder_id = id_factory_.NewLocalId();
246 entry_factory_->CreateUnsyncedItem(folder_id, id_factory_.root(), "folder", 246 entry_factory_->CreateUnsyncedItem(folder_id, id_factory_.root(), "folder",
247 true, BOOKMARKS, NULL); 247 true, BOOKMARKS, nullptr);
248 // Next five items are children of the folder 248 // Next five items are children of the folder
249 size_t i; 249 size_t i;
250 size_t batch_s = 5; 250 size_t batch_s = 5;
251 for (i = 0; i < batch_s; ++i) { 251 for (i = 0; i < batch_s; ++i) {
252 entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id, 252 entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id,
253 base::StringPrintf("Item %" PRIuS "", i), 253 base::StringPrintf("Item %" PRIuS "", i),
254 false, BOOKMARKS, NULL); 254 false, BOOKMARKS, nullptr);
255 } 255 }
256 // Next five items are children of the root. 256 // Next five items are children of the root.
257 for (; i < 2 * batch_s; ++i) { 257 for (; i < 2 * batch_s; ++i) {
258 entry_factory_->CreateUnsyncedItem( 258 entry_factory_->CreateUnsyncedItem(
259 id_factory_.NewLocalId(), id_factory_.root(), 259 id_factory_.NewLocalId(), id_factory_.root(),
260 base::StringPrintf("Item %" PRIuS "", i), false, BOOKMARKS, NULL); 260 base::StringPrintf("Item %" PRIuS "", i), false, BOOKMARKS, nullptr);
261 } 261 }
262 262
263 // We encrypt with new keys, triggering the local cryptographer to be unready 263 // We encrypt with new keys, triggering the local cryptographer to be unready
264 // and unable to decrypt data (once updated). 264 // and unable to decrypt data (once updated).
265 Cryptographer other_cryptographer(cryptographer->encryptor()); 265 Cryptographer other_cryptographer(cryptographer->encryptor());
266 KeyParams params = {"localhost", "dummy", "foobar"}; 266 KeyParams params = {"localhost", "dummy", "foobar"};
267 other_cryptographer.AddKey(params); 267 other_cryptographer.AddKey(params);
268 sync_pb::EntitySpecifics specifics; 268 sync_pb::EntitySpecifics specifics;
269 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); 269 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
270 other_cryptographer.GetKeys(nigori->mutable_encryption_keybag()); 270 other_cryptographer.GetKeys(nigori->mutable_encryption_keybag());
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 ApplyControlDataUpdates(directory()); 970 ApplyControlDataUpdates(directory());
971 971
972 // After applying the updates NIGORI should be marked as having its 972 // After applying the updates NIGORI should be marked as having its
973 // initial sync completed. 973 // initial sync completed.
974 EXPECT_TRUE(directory()->InitialSyncEndedForType(NIGORI)); 974 EXPECT_TRUE(directory()->InitialSyncEndedForType(NIGORI));
975 // Verify that there is no side effect on another control type. 975 // Verify that there is no side effect on another control type.
976 EXPECT_FALSE(directory()->InitialSyncEndedForType(EXPERIMENTS)); 976 EXPECT_FALSE(directory()->InitialSyncEndedForType(EXPERIMENTS));
977 } 977 }
978 978
979 } // namespace syncer 979 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine/sync_manager.cc ('k') | components/sync/engine_impl/attachments/attachment_downloader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698