OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
6 #include <stack> | 6 #include <stack> |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 return local_sync_status; | 349 return local_sync_status; |
350 | 350 |
351 remote_sync_status = ProcessRemoteChange(); | 351 remote_sync_status = ProcessRemoteChange(); |
352 if (remote_sync_status != SYNC_STATUS_OK && | 352 if (remote_sync_status != SYNC_STATUS_OK && |
353 remote_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC && | 353 remote_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC && |
354 remote_sync_status != SYNC_STATUS_FILE_BUSY) | 354 remote_sync_status != SYNC_STATUS_FILE_BUSY) |
355 return remote_sync_status; | 355 return remote_sync_status; |
356 | 356 |
357 if (local_sync_status == SYNC_STATUS_NO_CHANGE_TO_SYNC && | 357 if (local_sync_status == SYNC_STATUS_NO_CHANGE_TO_SYNC && |
358 remote_sync_status == SYNC_STATUS_NO_CHANGE_TO_SYNC) { | 358 remote_sync_status == SYNC_STATUS_NO_CHANGE_TO_SYNC) { |
359 remote_sync_service_->PromoteDemotedChanges(); | 359 |
360 local_sync_service_->PromoteDemotedChanges(); | 360 { |
| 361 base::RunLoop run_loop; |
| 362 remote_sync_service_->PromoteDemotedChanges(run_loop.QuitClosure()); |
| 363 run_loop.Run(); |
| 364 } |
| 365 |
| 366 { |
| 367 base::RunLoop run_loop; |
| 368 local_sync_service_->PromoteDemotedChanges(run_loop.QuitClosure()); |
| 369 run_loop.Run(); |
| 370 } |
361 | 371 |
362 if (pending_remote_changes_ || pending_local_changes_) | 372 if (pending_remote_changes_ || pending_local_changes_) |
363 continue; | 373 continue; |
364 | 374 |
365 base::RunLoop run_loop; | 375 base::RunLoop run_loop; |
366 int64 largest_fetched_change_id = -1; | 376 int64 largest_fetched_change_id = -1; |
367 PostTaskAndReplyWithResult( | 377 PostTaskAndReplyWithResult( |
368 worker_task_runner_, | 378 worker_task_runner_, |
369 FROM_HERE, | 379 FROM_HERE, |
370 base::Bind(&MetadataDatabase::GetLargestFetchedChangeID, | 380 base::Bind(&MetadataDatabase::GetLargestFetchedChangeID, |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 | 1706 |
1697 EXPECT_EQ(1u, CountApp()); | 1707 EXPECT_EQ(1u, CountApp()); |
1698 EXPECT_EQ(1u, CountLocalFile(app_id)); | 1708 EXPECT_EQ(1u, CountLocalFile(app_id)); |
1699 | 1709 |
1700 EXPECT_EQ(2u, CountMetadata()); | 1710 EXPECT_EQ(2u, CountMetadata()); |
1701 EXPECT_EQ(2u, CountTracker()); | 1711 EXPECT_EQ(2u, CountTracker()); |
1702 } | 1712 } |
1703 | 1713 |
1704 } // namespace drive_backend | 1714 } // namespace drive_backend |
1705 } // namespace sync_file_system | 1715 } // namespace sync_file_system |
OLD | NEW |