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 #include "chrome/browser/sync/sessions/sync_session.h" | 5 #include "chrome/browser/sync/sessions/sync_session.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 std::vector<int64> unsynced_handles; | 211 std::vector<int64> unsynced_handles; |
212 unsynced_handles.push_back(1); | 212 unsynced_handles.push_back(1); |
213 unsynced_handles.push_back(2); | 213 unsynced_handles.push_back(2); |
214 status()->set_unsynced_handles(unsynced_handles); | 214 status()->set_unsynced_handles(unsynced_handles); |
215 EXPECT_FALSE(session_->HasMoreToSync()); | 215 EXPECT_FALSE(session_->HasMoreToSync()); |
216 status()->increment_num_successful_commits(); | 216 status()->increment_num_successful_commits(); |
217 EXPECT_TRUE(session_->HasMoreToSync()); | 217 EXPECT_TRUE(session_->HasMoreToSync()); |
218 } | 218 } |
219 | 219 |
220 TEST_F(SyncSessionTest, MoreToSyncIfConflictSetsBuilt) { | |
221 // If we built conflict sets, then we need to loop back and try | |
222 // to get updates & commit again. | |
223 status()->update_conflict_sets_built(true); | |
224 EXPECT_TRUE(session_->HasMoreToSync()); | |
225 } | |
226 | |
227 TEST_F(SyncSessionTest, MoreToDownloadIfDownloadFailed) { | 220 TEST_F(SyncSessionTest, MoreToDownloadIfDownloadFailed) { |
228 status()->set_updates_request_types(ParamsMeaningAllEnabledTypes()); | 221 status()->set_updates_request_types(ParamsMeaningAllEnabledTypes()); |
229 | 222 |
230 // When DownloadUpdatesCommand fails, these should be false. | 223 // When DownloadUpdatesCommand fails, these should be false. |
231 EXPECT_FALSE(status()->ServerSaysNothingMoreToDownload()); | 224 EXPECT_FALSE(status()->ServerSaysNothingMoreToDownload()); |
232 EXPECT_FALSE(status()->download_updates_succeeded()); | 225 EXPECT_FALSE(status()->download_updates_succeeded()); |
233 | 226 |
234 // Download updates has its own loop in the syncer; it shouldn't factor | 227 // Download updates has its own loop in the syncer; it shouldn't factor |
235 // into HasMoreToSync. | 228 // into HasMoreToSync. |
236 EXPECT_FALSE(session_->HasMoreToSync()); | 229 EXPECT_FALSE(session_->HasMoreToSync()); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); | 584 EXPECT_EQ(empty_payload, original[syncable::BOOKMARKS]); |
592 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); | 585 EXPECT_EQ(payload1, original[syncable::PASSWORDS]); |
593 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); | 586 EXPECT_EQ(payload1, original[syncable::AUTOFILL]); |
594 EXPECT_EQ(payload2, original[syncable::SESSIONS]); | 587 EXPECT_EQ(payload2, original[syncable::SESSIONS]); |
595 EXPECT_EQ(payload3, original[syncable::THEMES]); | 588 EXPECT_EQ(payload3, original[syncable::THEMES]); |
596 } | 589 } |
597 | 590 |
598 } // namespace | 591 } // namespace |
599 } // namespace sessions | 592 } // namespace sessions |
600 } // namespace browser_sync | 593 } // namespace browser_sync |
OLD | NEW |