Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/drive_backend_sync_unittest.cc

Issue 390283002: [SyncFS] Demote local file changes before local-to-remote sync (3/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: debug printfs Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/local/local_file_change_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/local/local_file_change_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698