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

Side by Side Diff: chrome/browser/sync/engine/apply_updates_command_unittest.cc

Issue 7016011: iwyu: Include stringprintf.h where appropriate, part 3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix. Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/string_util.h" 8 #include "base/stringprintf.h"
9 #include "chrome/browser/sync/engine/apply_updates_command.h" 9 #include "chrome/browser/sync/engine/apply_updates_command.h"
10 #include "chrome/browser/sync/engine/syncer.h" 10 #include "chrome/browser/sync/engine/syncer.h"
11 #include "chrome/browser/sync/engine/syncer_util.h" 11 #include "chrome/browser/sync/engine/syncer_util.h"
12 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" 12 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
13 #include "chrome/browser/sync/sessions/sync_session.h" 13 #include "chrome/browser/sync/sessions/sync_session.h"
14 #include "chrome/browser/sync/syncable/directory_manager.h" 14 #include "chrome/browser/sync/syncable/directory_manager.h"
15 #include "chrome/browser/sync/syncable/nigori_util.h" 15 #include "chrome/browser/sync/syncable/nigori_util.h"
16 #include "chrome/browser/sync/syncable/syncable.h" 16 #include "chrome/browser/sync/syncable/syncable.h"
17 #include "chrome/browser/sync/syncable/syncable_id.h" 17 #include "chrome/browser/sync/syncable/syncable_id.h"
18 #include "chrome/test/sync/engine/syncer_command_test.h" 18 #include "chrome/test/sync/engine/syncer_command_test.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // Create unsynced bookmarks without encryption. 401 // Create unsynced bookmarks without encryption.
402 // First item is a folder 402 // First item is a folder
403 Id folder_id = id_factory_.NewLocalId(); 403 Id folder_id = id_factory_.NewLocalId();
404 CreateUnsyncedItem(folder_id, id_factory_.root(), "folder", 404 CreateUnsyncedItem(folder_id, id_factory_.root(), "folder",
405 true, syncable::BOOKMARKS, NULL); 405 true, syncable::BOOKMARKS, NULL);
406 // Next five items are children of the folder 406 // Next five items are children of the folder
407 size_t i; 407 size_t i;
408 size_t batch_s = 5; 408 size_t batch_s = 5;
409 for (i = 0; i < batch_s; ++i) { 409 for (i = 0; i < batch_s; ++i) {
410 CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id, 410 CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id,
411 StringPrintf("Item %"PRIuS"", i), false, 411 base::StringPrintf("Item %"PRIuS"", i), false,
412 syncable::BOOKMARKS, NULL); 412 syncable::BOOKMARKS, NULL);
413 } 413 }
414 // Next five items are children of the root. 414 // Next five items are children of the root.
415 for (; i < 2*batch_s; ++i) { 415 for (; i < 2*batch_s; ++i) {
416 CreateUnsyncedItem(id_factory_.NewLocalId(), id_factory_.root(), 416 CreateUnsyncedItem(id_factory_.NewLocalId(), id_factory_.root(),
417 StringPrintf("Item %"PRIuS"", i), false, 417 base::StringPrintf("Item %"PRIuS"", i), false,
418 syncable::BOOKMARKS, NULL); 418 syncable::BOOKMARKS, NULL);
419 } 419 }
420 420
421 KeyParams params = {"localhost", "dummy", "foobar"}; 421 KeyParams params = {"localhost", "dummy", "foobar"};
422 cryptographer->AddKey(params); 422 cryptographer->AddKey(params);
423 sync_pb::EntitySpecifics specifics; 423 sync_pb::EntitySpecifics specifics;
424 sync_pb::NigoriSpecifics* nigori = 424 sync_pb::NigoriSpecifics* nigori =
425 specifics.MutableExtension(sync_pb::nigori); 425 specifics.MutableExtension(sync_pb::nigori);
426 cryptographer->GetKeys(nigori->mutable_encrypted()); 426 cryptographer->GetKeys(nigori->mutable_encrypted());
427 nigori->set_encrypt_bookmarks(true); 427 nigori->set_encrypt_bookmarks(true);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Create unsynced bookmarks without encryption. 497 // Create unsynced bookmarks without encryption.
498 // First item is a folder 498 // First item is a folder
499 Id folder_id = id_factory_.NewLocalId(); 499 Id folder_id = id_factory_.NewLocalId();
500 CreateUnsyncedItem(folder_id, id_factory_.root(), "folder", true, 500 CreateUnsyncedItem(folder_id, id_factory_.root(), "folder", true,
501 syncable::BOOKMARKS, NULL); 501 syncable::BOOKMARKS, NULL);
502 // Next five items are children of the folder 502 // Next five items are children of the folder
503 size_t i; 503 size_t i;
504 size_t batch_s = 5; 504 size_t batch_s = 5;
505 for (i = 0; i < batch_s; ++i) { 505 for (i = 0; i < batch_s; ++i) {
506 CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id, 506 CreateUnsyncedItem(id_factory_.NewLocalId(), folder_id,
507 StringPrintf("Item %"PRIuS"", i), false, 507 base::StringPrintf("Item %"PRIuS"", i), false,
508 syncable::BOOKMARKS, NULL); 508 syncable::BOOKMARKS, NULL);
509 } 509 }
510 // Next five items are children of the root. 510 // Next five items are children of the root.
511 for (; i < 2*batch_s; ++i) { 511 for (; i < 2*batch_s; ++i) {
512 CreateUnsyncedItem(id_factory_.NewLocalId(), id_factory_.root(), 512 CreateUnsyncedItem(id_factory_.NewLocalId(), id_factory_.root(),
513 StringPrintf("Item %"PRIuS"", i), false, 513 base::StringPrintf("Item %"PRIuS"", i), false,
514 syncable::BOOKMARKS, NULL); 514 syncable::BOOKMARKS, NULL);
515 } 515 }
516 516
517 // We encrypt with new keys, triggering the local cryptographer to be unready 517 // We encrypt with new keys, triggering the local cryptographer to be unready
518 // and unable to decrypt data (once updated). 518 // and unable to decrypt data (once updated).
519 Cryptographer other_cryptographer; 519 Cryptographer other_cryptographer;
520 KeyParams params = {"localhost", "dummy", "foobar"}; 520 KeyParams params = {"localhost", "dummy", "foobar"};
521 other_cryptographer.AddKey(params); 521 other_cryptographer.AddKey(params);
522 sync_pb::EntitySpecifics specifics; 522 sync_pb::EntitySpecifics specifics;
523 sync_pb::NigoriSpecifics* nigori = 523 sync_pb::NigoriSpecifics* nigori =
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 encrypted_types.clear(); 568 encrypted_types.clear();
569 EXPECT_EQ(encrypted_types, GetEncryptedDataTypes(&trans)); 569 EXPECT_EQ(encrypted_types, GetEncryptedDataTypes(&trans));
570 570
571 Syncer::UnsyncedMetaHandles handles; 571 Syncer::UnsyncedMetaHandles handles;
572 SyncerUtil::GetUnsyncedEntries(&trans, &handles); 572 SyncerUtil::GetUnsyncedEntries(&trans, &handles);
573 EXPECT_EQ(2*batch_s+1, handles.size()); 573 EXPECT_EQ(2*batch_s+1, handles.size());
574 } 574 }
575 } 575 }
576 576
577 } // namespace browser_sync 577 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698