OLD | NEW |
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 3710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3721 ASSERT_TRUE(entry.good()); | 3721 ASSERT_TRUE(entry.good()); |
3722 EXPECT_TRUE(entry.Put(PARENT_ID, ids_.FromNumber(1))); | 3722 EXPECT_TRUE(entry.Put(PARENT_ID, ids_.FromNumber(1))); |
3723 EXPECT_TRUE(entry.Put(IS_UNSYNCED, true)); | 3723 EXPECT_TRUE(entry.Put(IS_UNSYNCED, true)); |
3724 } | 3724 } |
3725 SyncShareAsDelegate(); | 3725 SyncShareAsDelegate(); |
3726 // We use the same sync ts as before so our times match up. | 3726 // We use the same sync ts as before so our times match up. |
3727 mock_server_->AddUpdateDirectory(2, 1, ":::", 2, 2); | 3727 mock_server_->AddUpdateDirectory(2, 1, ":::", 2, 2); |
3728 SyncShareAsDelegate(); | 3728 SyncShareAsDelegate(); |
3729 } | 3729 } |
3730 | 3730 |
3731 TEST(SortedCollectionsIntersect, SortedCollectionsIntersectTest) { | |
3732 int negative[] = {-3, -2, -1}; | |
3733 int straddle[] = {-1, 0, 1}; | |
3734 int positive[] = {1, 2, 3}; | |
3735 EXPECT_TRUE(SortedCollectionsIntersect(negative, negative + 3, | |
3736 straddle, straddle + 3)); | |
3737 EXPECT_FALSE(SortedCollectionsIntersect(negative, negative + 3, | |
3738 positive, positive + 3)); | |
3739 EXPECT_TRUE(SortedCollectionsIntersect(straddle, straddle + 3, | |
3740 positive, positive + 3)); | |
3741 EXPECT_FALSE(SortedCollectionsIntersect(straddle + 2, straddle + 3, | |
3742 positive, positive)); | |
3743 EXPECT_FALSE(SortedCollectionsIntersect(straddle, straddle + 3, | |
3744 positive + 1, positive + 1)); | |
3745 EXPECT_TRUE(SortedCollectionsIntersect(straddle, straddle + 3, | |
3746 positive, positive + 1)); | |
3747 } | |
3748 | |
3749 // Don't crash when this occurs. | 3731 // Don't crash when this occurs. |
3750 TEST_F(SyncerTest, UpdateWhereParentIsNotAFolder) { | 3732 TEST_F(SyncerTest, UpdateWhereParentIsNotAFolder) { |
3751 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); | 3733 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); |
3752 CHECK(dir.good()); | 3734 CHECK(dir.good()); |
3753 mock_server_->AddUpdateBookmark(1, 0, "B", 10, 10); | 3735 mock_server_->AddUpdateBookmark(1, 0, "B", 10, 10); |
3754 mock_server_->AddUpdateDirectory(2, 1, "BookmarkParent", 10, 10); | 3736 mock_server_->AddUpdateDirectory(2, 1, "BookmarkParent", 10, 10); |
3755 // Used to cause a CHECK | 3737 // Used to cause a CHECK |
3756 SyncShareAsDelegate(); | 3738 SyncShareAsDelegate(); |
3757 { | 3739 { |
3758 ReadTransaction rtrans(dir, __FILE__, __LINE__); | 3740 ReadTransaction rtrans(dir, __FILE__, __LINE__); |
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5193 Add(low_id_); | 5175 Add(low_id_); |
5194 Add(high_id_); | 5176 Add(high_id_); |
5195 SyncShareAsDelegate(); | 5177 SyncShareAsDelegate(); |
5196 ExpectLocalOrderIsByServerId(); | 5178 ExpectLocalOrderIsByServerId(); |
5197 } | 5179 } |
5198 | 5180 |
5199 const SyncerTest::CommitOrderingTest | 5181 const SyncerTest::CommitOrderingTest |
5200 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; | 5182 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; |
5201 | 5183 |
5202 } // namespace browser_sync | 5184 } // namespace browser_sync |
OLD | NEW |