OLD | NEW |
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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
8 | 8 |
9 #include <cstddef> | 9 #include <cstddef> |
10 #include <map> | 10 #include <map> |
(...skipping 2842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2853 // found. Returns -1 on lookup failure. | 2853 // found. Returns -1 on lookup failure. |
2854 size_t FindChangeInList(int64 id, ChangeRecord::Action action) { | 2854 size_t FindChangeInList(int64 id, ChangeRecord::Action action) { |
2855 SCOPED_TRACE(id); | 2855 SCOPED_TRACE(id); |
2856 for (size_t i = 0; i < last_changes_.Get().size(); ++i) { | 2856 for (size_t i = 0; i < last_changes_.Get().size(); ++i) { |
2857 if (last_changes_.Get()[i].id == id | 2857 if (last_changes_.Get()[i].id == id |
2858 && last_changes_.Get()[i].action == action) { | 2858 && last_changes_.Get()[i].action == action) { |
2859 return i; | 2859 return i; |
2860 } | 2860 } |
2861 } | 2861 } |
2862 ADD_FAILURE() << "Failed to find specified change"; | 2862 ADD_FAILURE() << "Failed to find specified change"; |
2863 return -1; | 2863 return static_cast<size_t>(-1); |
2864 } | 2864 } |
2865 | 2865 |
2866 // Returns the current size of the change list. | 2866 // Returns the current size of the change list. |
2867 // | 2867 // |
2868 // Note that spurious changes do not necessarily indicate a problem. | 2868 // Note that spurious changes do not necessarily indicate a problem. |
2869 // Assertions on change list size can help detect problems, but it may be | 2869 // Assertions on change list size can help detect problems, but it may be |
2870 // necessary to reduce their strictness if the implementation changes. | 2870 // necessary to reduce their strictness if the implementation changes. |
2871 size_t GetChangeListSize() { | 2871 size_t GetChangeListSize() { |
2872 return last_changes_.Get().size(); | 2872 return last_changes_.Get().size(); |
2873 } | 2873 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3125 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3125 // SyncManagerInitInvalidStorageTest::GetFactory will return |
3126 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3126 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. |
3127 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3127 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's |
3128 // task is to ensure that SyncManagerImpl reported initialization failure in | 3128 // task is to ensure that SyncManagerImpl reported initialization failure in |
3129 // OnInitializationComplete callback. | 3129 // OnInitializationComplete callback. |
3130 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3130 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { |
3131 EXPECT_FALSE(initialization_succeeded_); | 3131 EXPECT_FALSE(initialization_succeeded_); |
3132 } | 3132 } |
3133 | 3133 |
3134 } // namespace syncer | 3134 } // namespace syncer |
OLD | NEW |