| 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 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2855 // found. Returns -1 on lookup failure. | 2855 // found. Returns -1 on lookup failure. |
| 2856 size_t FindChangeInList(int64 id, ChangeRecord::Action action) { | 2856 size_t FindChangeInList(int64 id, ChangeRecord::Action action) { |
| 2857 SCOPED_TRACE(id); | 2857 SCOPED_TRACE(id); |
| 2858 for (size_t i = 0; i < last_changes_.Get().size(); ++i) { | 2858 for (size_t i = 0; i < last_changes_.Get().size(); ++i) { |
| 2859 if (last_changes_.Get()[i].id == id | 2859 if (last_changes_.Get()[i].id == id |
| 2860 && last_changes_.Get()[i].action == action) { | 2860 && last_changes_.Get()[i].action == action) { |
| 2861 return i; | 2861 return i; |
| 2862 } | 2862 } |
| 2863 } | 2863 } |
| 2864 ADD_FAILURE() << "Failed to find specified change"; | 2864 ADD_FAILURE() << "Failed to find specified change"; |
| 2865 return -1; | 2865 return static_cast<size_t>(-1); |
| 2866 } | 2866 } |
| 2867 | 2867 |
| 2868 // Returns the current size of the change list. | 2868 // Returns the current size of the change list. |
| 2869 // | 2869 // |
| 2870 // Note that spurious changes do not necessarily indicate a problem. | 2870 // Note that spurious changes do not necessarily indicate a problem. |
| 2871 // Assertions on change list size can help detect problems, but it may be | 2871 // Assertions on change list size can help detect problems, but it may be |
| 2872 // necessary to reduce their strictness if the implementation changes. | 2872 // necessary to reduce their strictness if the implementation changes. |
| 2873 size_t GetChangeListSize() { | 2873 size_t GetChangeListSize() { |
| 2874 return last_changes_.Get().size(); | 2874 return last_changes_.Get().size(); |
| 2875 } | 2875 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3127 // SyncManagerInitInvalidStorageTest::GetFactory will return |
| 3128 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3128 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. |
| 3129 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3129 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's |
| 3130 // task is to ensure that SyncManagerImpl reported initialization failure in | 3130 // task is to ensure that SyncManagerImpl reported initialization failure in |
| 3131 // OnInitializationComplete callback. | 3131 // OnInitializationComplete callback. |
| 3132 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3132 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { |
| 3133 EXPECT_FALSE(initialization_succeeded_); | 3133 EXPECT_FALSE(initialization_succeeded_); |
| 3134 } | 3134 } |
| 3135 | 3135 |
| 3136 } // namespace syncer | 3136 } // namespace syncer |
| OLD | NEW |