OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // TODO(akalin): This file is basically just a unit test for | 5 // TODO(akalin): This file is basically just a unit test for |
6 // BookmarkChangeProcessor. Write unit tests for | 6 // BookmarkChangeProcessor. Write unit tests for |
7 // BookmarkModelAssociator separately. | 7 // BookmarkModelAssociator separately. |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 node.SetExternalId(0); | 539 node.SetExternalId(0); |
540 last_child_id = node.GetId(); | 540 last_child_id = node.GetId(); |
541 } | 541 } |
542 return true; | 542 return true; |
543 } | 543 } |
544 | 544 |
545 bool AssociateModels() { | 545 bool AssociateModels() { |
546 DCHECK(!model_associator_); | 546 DCHECK(!model_associator_); |
547 | 547 |
548 // Set up model associator. | 548 // Set up model associator. |
549 model_associator_.reset(new BookmarkModelAssociator( | 549 model_associator_ = base::MakeUnique<BookmarkModelAssociator>( |
550 model_.get(), sync_client_.get(), test_user_share_.user_share(), | 550 model_.get(), sync_client_.get(), test_user_share_.user_share(), |
551 base::MakeUnique<syncer::DataTypeErrorHandlerMock>(), | 551 base::MakeUnique<syncer::DataTypeErrorHandlerMock>(), |
552 kExpectMobileBookmarks)); | 552 kExpectMobileBookmarks); |
553 | 553 |
554 local_merge_result_ = syncer::SyncMergeResult(syncer::BOOKMARKS); | 554 local_merge_result_ = syncer::SyncMergeResult(syncer::BOOKMARKS); |
555 syncer_merge_result_ = syncer::SyncMergeResult(syncer::BOOKMARKS); | 555 syncer_merge_result_ = syncer::SyncMergeResult(syncer::BOOKMARKS); |
556 int local_count_before = model_->root_node()->GetTotalNodeCount(); | 556 int local_count_before = model_->root_node()->GetTotalNodeCount(); |
557 int syncer_count_before = GetSyncBookmarkCount(); | 557 int syncer_count_before = GetSyncBookmarkCount(); |
558 | 558 |
559 syncer::SyncError error = model_associator_->AssociateModels( | 559 syncer::SyncError error = model_associator_->AssociateModels( |
560 &local_merge_result_, &syncer_merge_result_); | 560 &local_merge_result_, &syncer_merge_result_); |
561 if (error.IsSet()) | 561 if (error.IsSet()) |
562 return false; | 562 return false; |
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2592 EXPECT_EQ(syncer::kInvalidId, sync_id); | 2592 EXPECT_EQ(syncer::kInvalidId, sync_id); |
2593 | 2593 |
2594 // Verify that Sync ignores deleting this node. | 2594 // Verify that Sync ignores deleting this node. |
2595 model()->Remove(node); | 2595 model()->Remove(node); |
2596 EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount()); | 2596 EXPECT_EQ(sync_bookmark_count, GetSyncBookmarkCount()); |
2597 } | 2597 } |
2598 | 2598 |
2599 } // namespace | 2599 } // namespace |
2600 | 2600 |
2601 } // namespace browser_sync | 2601 } // namespace browser_sync |
OLD | NEW |