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

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

Issue 8922015: [Sync] Don't commit items with predecessors/parents in conflict. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years 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 // Syncer unit tests. Unfortunately a lot of these tests 5 // Syncer unit tests. Unfortunately a lot of these tests
6 // are outdated and need to be reworked and updated. 6 // are outdated and need to be reworked and updated.
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 #include <list> 10 #include <list>
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 other_params); 703 other_params);
704 } 704 }
705 SyncShareAsDelegate(); 705 SyncShareAsDelegate();
706 { 706 {
707 // 2 unsynced handles to reflect the items that committed succesfully. 707 // 2 unsynced handles to reflect the items that committed succesfully.
708 EXPECT_EQ(2U, session_->status_controller().unsynced_handles().size()); 708 EXPECT_EQ(2U, session_->status_controller().unsynced_handles().size());
709 // All properly encrypted and non-conflicting items should commit. "A" was 709 // All properly encrypted and non-conflicting items should commit. "A" was
710 // conflicting, but last sync cycle resolved it as simple conflict, so on 710 // conflicting, but last sync cycle resolved it as simple conflict, so on
711 // this sync cycle it committed succesfullly. 711 // this sync cycle it committed succesfullly.
712 ReadTransaction rtrans(FROM_HERE, dir); 712 ReadTransaction rtrans(FROM_HERE, dir);
713 // Committed successfully. 713 // Has unready predecessor.
714 VERIFY_ENTRY(1, false, false, false, 0, 21, 21, ids_, &rtrans); 714 VERIFY_ENTRY(1, false, true, false, 0, 20, 20, ids_, &rtrans);
715 // Committed successfully. 715 // Has unready predecessor.
716 VERIFY_ENTRY(2, false, false, false, 0, 11, 11, ids_, &rtrans); 716 VERIFY_ENTRY(2, false, true, false, 0, 10, 10, ids_, &rtrans);
717 // Was not properly encrypted. 717 // Was not properly encrypted.
718 VERIFY_ENTRY(3, false, true, false, 0, 10, 10, ids_, &rtrans); 718 VERIFY_ENTRY(3, false, true, false, 0, 10, 10, ids_, &rtrans);
719 // Was not properly encrypted. 719 // Was not properly encrypted.
720 VERIFY_ENTRY(4, false, true, false, 0, 10, 10, ids_, &rtrans); 720 VERIFY_ENTRY(4, false, true, false, 0, 10, 10, ids_, &rtrans);
721 } 721 }
722 { 722 {
723 // Fix the remaining items. 723 // Fix the remaining items.
724 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); 724 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir);
725 MutableEntry C(&wtrans, GET_BY_ID, ids_.FromNumber(3)); 725 MutableEntry C(&wtrans, GET_BY_ID, ids_.FromNumber(3));
726 ASSERT_TRUE(C.good()); 726 ASSERT_TRUE(C.good());
727 C.Put(SPECIFICS, encrypted_bookmark); 727 C.Put(SPECIFICS, encrypted_bookmark);
728 C.Put(NON_UNIQUE_NAME, kEncryptedString); 728 C.Put(NON_UNIQUE_NAME, kEncryptedString);
729 MutableEntry D(&wtrans, GET_BY_ID, ids_.FromNumber(4)); 729 MutableEntry D(&wtrans, GET_BY_ID, ids_.FromNumber(4));
730 ASSERT_TRUE(D.good()); 730 ASSERT_TRUE(D.good());
731 D.Put(SPECIFICS, encrypted_bookmark); 731 D.Put(SPECIFICS, encrypted_bookmark);
732 D.Put(NON_UNIQUE_NAME, kEncryptedString); 732 D.Put(NON_UNIQUE_NAME, kEncryptedString);
733 } 733 }
734 SyncShareAsDelegate(); 734 SyncShareAsDelegate();
735 { 735 {
736 // We attempted to commit two items. 736 // We attempted to commit four items.
737 EXPECT_EQ(2U, session_->status_controller().unsynced_handles().size()); 737 EXPECT_EQ(4U, session_->status_controller().unsynced_handles().size());
738 EXPECT_TRUE(session_->status_controller().did_commit_items()); 738 EXPECT_TRUE(session_->status_controller().did_commit_items());
739 // None should be unsynced anymore. 739 // None should be unsynced anymore.
740 ReadTransaction rtrans(FROM_HERE, dir); 740 ReadTransaction rtrans(FROM_HERE, dir);
741 VERIFY_ENTRY(1, false, false, false, 0, 21, 21, ids_, &rtrans); 741 VERIFY_ENTRY(1, false, false, false, 0, 21, 21, ids_, &rtrans);
742 VERIFY_ENTRY(2, false, false, false, 0, 11, 11, ids_, &rtrans); 742 VERIFY_ENTRY(2, false, false, false, 0, 11, 11, ids_, &rtrans);
743 VERIFY_ENTRY(3, false, false, false, 0, 11, 11, ids_, &rtrans); 743 VERIFY_ENTRY(3, false, false, false, 0, 11, 11, ids_, &rtrans);
744 VERIFY_ENTRY(4, false, false, false, 0, 11, 11, ids_, &rtrans); 744 VERIFY_ENTRY(4, false, false, false, 0, 11, 11, ids_, &rtrans);
745 } 745 }
746 } 746 }
747 747
(...skipping 4891 matching lines...) Expand 10 before | Expand all | Expand 10 after
5639 Add(low_id_); 5639 Add(low_id_);
5640 Add(high_id_); 5640 Add(high_id_);
5641 SyncShareAsDelegate(); 5641 SyncShareAsDelegate();
5642 ExpectLocalOrderIsByServerId(); 5642 ExpectLocalOrderIsByServerId();
5643 } 5643 }
5644 5644
5645 const SyncerTest::CommitOrderingTest 5645 const SyncerTest::CommitOrderingTest
5646 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; 5646 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()};
5647 5647
5648 } // namespace browser_sync 5648 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698