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

Side by Side Diff: sync/engine/apply_control_data_updates_unittest.cc

Issue 13721002: Add a space between string literals and PRIuS (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 8 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 "base/format_macros.h" 5 #include "base/format_macros.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "sync/engine/apply_control_data_updates.h" 9 #include "sync/engine/apply_control_data_updates.h"
10 #include "sync/engine/syncer.h" 10 #include "sync/engine/syncer.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Create unsynced bookmarks without encryption. 126 // Create unsynced bookmarks without encryption.
127 // First item is a folder 127 // First item is a folder
128 Id folder_id = id_factory_.NewLocalId(); 128 Id folder_id = id_factory_.NewLocalId();
129 entry_factory_->CreateUnsyncedItem(folder_id, id_factory_.root(), "folder", 129 entry_factory_->CreateUnsyncedItem(folder_id, id_factory_.root(), "folder",
130 true, BOOKMARKS, NULL); 130 true, BOOKMARKS, NULL);
131 // Next five items are children of the folder 131 // Next five items are children of the folder
132 size_t i; 132 size_t i;
133 size_t batch_s = 5; 133 size_t batch_s = 5;
134 for (i = 0; i < batch_s; ++i) { 134 for (i = 0; i < batch_s; ++i) {
135 entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id, 135 entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id,
136 base::StringPrintf("Item %"PRIuS"", i), 136 base::StringPrintf("Item %" PRIuS "", i),
137 false, BOOKMARKS, NULL); 137 false, BOOKMARKS, NULL);
138 } 138 }
139 // Next five items are children of the root. 139 // Next five items are children of the root.
140 for (; i < 2*batch_s; ++i) { 140 for (; i < 2*batch_s; ++i) {
141 entry_factory_->CreateUnsyncedItem( 141 entry_factory_->CreateUnsyncedItem(
142 id_factory_.NewLocalId(), id_factory_.root(), 142 id_factory_.NewLocalId(), id_factory_.root(),
143 base::StringPrintf("Item %"PRIuS"", i), false, 143 base::StringPrintf("Item %" PRIuS "", i), false,
144 BOOKMARKS, NULL); 144 BOOKMARKS, NULL);
145 } 145 }
146 146
147 KeyParams params = {"localhost", "dummy", "foobar"}; 147 KeyParams params = {"localhost", "dummy", "foobar"};
148 cryptographer->AddKey(params); 148 cryptographer->AddKey(params);
149 sync_pb::EntitySpecifics specifics; 149 sync_pb::EntitySpecifics specifics;
150 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); 150 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
151 cryptographer->GetKeys(nigori->mutable_encryption_keybag()); 151 cryptographer->GetKeys(nigori->mutable_encryption_keybag());
152 nigori->set_encrypt_everything(true); 152 nigori->set_encrypt_everything(true);
153 encrypted_types.Put(BOOKMARKS); 153 encrypted_types.Put(BOOKMARKS);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // First item is a folder 240 // First item is a folder
241 Id folder_id = id_factory_.NewLocalId(); 241 Id folder_id = id_factory_.NewLocalId();
242 entry_factory_->CreateUnsyncedItem( 242 entry_factory_->CreateUnsyncedItem(
243 folder_id, id_factory_.root(), "folder", true, 243 folder_id, id_factory_.root(), "folder", true,
244 BOOKMARKS, NULL); 244 BOOKMARKS, NULL);
245 // Next five items are children of the folder 245 // Next five items are children of the folder
246 size_t i; 246 size_t i;
247 size_t batch_s = 5; 247 size_t batch_s = 5;
248 for (i = 0; i < batch_s; ++i) { 248 for (i = 0; i < batch_s; ++i) {
249 entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id, 249 entry_factory_->CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id,
250 base::StringPrintf("Item %"PRIuS"", i), 250 base::StringPrintf("Item %" PRIuS "", i),
251 false, BOOKMARKS, NULL); 251 false, BOOKMARKS, NULL);
252 } 252 }
253 // Next five items are children of the root. 253 // Next five items are children of the root.
254 for (; i < 2*batch_s; ++i) { 254 for (; i < 2*batch_s; ++i) {
255 entry_factory_->CreateUnsyncedItem( 255 entry_factory_->CreateUnsyncedItem(
256 id_factory_.NewLocalId(), id_factory_.root(), 256 id_factory_.NewLocalId(), id_factory_.root(),
257 base::StringPrintf("Item %"PRIuS"", i), false, 257 base::StringPrintf("Item %" PRIuS "", i), false,
258 BOOKMARKS, NULL); 258 BOOKMARKS, NULL);
259 } 259 }
260 260
261 // We encrypt with new keys, triggering the local cryptographer to be unready 261 // We encrypt with new keys, triggering the local cryptographer to be unready
262 // and unable to decrypt data (once updated). 262 // and unable to decrypt data (once updated).
263 Cryptographer other_cryptographer(cryptographer->encryptor()); 263 Cryptographer other_cryptographer(cryptographer->encryptor());
264 KeyParams params = {"localhost", "dummy", "foobar"}; 264 KeyParams params = {"localhost", "dummy", "foobar"};
265 other_cryptographer.AddKey(params); 265 other_cryptographer.AddKey(params);
266 sync_pb::EntitySpecifics specifics; 266 sync_pb::EntitySpecifics specifics;
267 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori(); 267 sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 local_specifics); 910 local_specifics);
911 ApplyControlDataUpdates(session()); 911 ApplyControlDataUpdates(session());
912 912
913 EXPECT_FALSE(entry_factory_->GetIsUnappliedForItem(experiment_handle)); 913 EXPECT_FALSE(entry_factory_->GetIsUnappliedForItem(experiment_handle));
914 EXPECT_TRUE( 914 EXPECT_TRUE(
915 entry_factory_->GetLocalSpecificsForItem(experiment_handle). 915 entry_factory_->GetLocalSpecificsForItem(experiment_handle).
916 experiments().keystore_encryption().enabled()); 916 experiments().keystore_encryption().enabled());
917 } 917 }
918 918
919 } // namespace syncer 919 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698