| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 void FetchRemoteChanges() { | 333 void FetchRemoteChanges() { |
| 334 remote_sync_service_->OnNotificationReceived(); | 334 remote_sync_service_->OnNotificationReceived(); |
| 335 WaitForIdleWorker(); | 335 WaitForIdleWorker(); |
| 336 } | 336 } |
| 337 | 337 |
| 338 SyncStatusCode ProcessChangesUntilDone() { | 338 SyncStatusCode ProcessChangesUntilDone() { |
| 339 int task_limit = 100; | 339 int task_limit = 100; |
| 340 SyncStatusCode local_sync_status; | 340 SyncStatusCode local_sync_status; |
| 341 SyncStatusCode remote_sync_status; | 341 SyncStatusCode remote_sync_status; |
| 342 while (true) { | 342 while (true) { |
| 343 base::RunLoop().RunUntilIdle(); |
| 344 WaitForIdleWorker(); |
| 345 |
| 343 if (!task_limit--) | 346 if (!task_limit--) |
| 344 return SYNC_STATUS_ABORT; | 347 return SYNC_STATUS_ABORT; |
| 345 | 348 |
| 346 local_sync_status = ProcessLocalChange(); | 349 local_sync_status = ProcessLocalChange(); |
| 347 if (local_sync_status != SYNC_STATUS_OK && | 350 if (local_sync_status != SYNC_STATUS_OK && |
| 348 local_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC && | 351 local_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC && |
| 349 local_sync_status != SYNC_STATUS_FILE_BUSY) | 352 local_sync_status != SYNC_STATUS_FILE_BUSY) |
| 350 return local_sync_status; | 353 return local_sync_status; |
| 351 | 354 |
| 352 remote_sync_status = ProcessRemoteChange(); | 355 remote_sync_status = ProcessRemoteChange(); |
| (...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 | 1724 |
| 1722 EXPECT_EQ(1u, CountApp()); | 1725 EXPECT_EQ(1u, CountApp()); |
| 1723 EXPECT_EQ(1u, CountLocalFile(app_id)); | 1726 EXPECT_EQ(1u, CountLocalFile(app_id)); |
| 1724 | 1727 |
| 1725 EXPECT_EQ(2u, CountMetadata()); | 1728 EXPECT_EQ(2u, CountMetadata()); |
| 1726 EXPECT_EQ(2u, CountTracker()); | 1729 EXPECT_EQ(2u, CountTracker()); |
| 1727 } | 1730 } |
| 1728 | 1731 |
| 1729 } // namespace drive_backend | 1732 } // namespace drive_backend |
| 1730 } // namespace sync_file_system | 1733 } // namespace sync_file_system |
| OLD | NEW |