Commit b50fd943 authored by tzik@chromium.org's avatar tzik@chromium.org

[SyncFS] Promote demoted changes in default remote side backend

BUG=401853

Review URL: https://codereview.chromium.org/453673003

Cr-Commit-Position: refs/heads/master@{#289135}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289135 0039d316-1c4b-4281-b951-d872f2087c98
parent 149e9680
......@@ -368,8 +368,11 @@ void SyncFileSystemService::OnSyncIdle() {
local_sync_runners_.begin();
iter != local_sync_runners_.end(); ++iter)
local_changes += (*iter)->pending_changes();
if (local_changes == 0 && v2_remote_service_)
v2_remote_service_->PromoteDemotedChanges(NoopClosure());
if (local_changes == 0) {
remote_service_->PromoteDemotedChanges(NoopClosure());
if (v2_remote_service_)
v2_remote_service_->PromoteDemotedChanges(NoopClosure());
}
}
SyncServiceState SyncFileSystemService::GetSyncServiceState() {
......
......@@ -119,6 +119,11 @@ ACTION_P2(MockSyncFileCallback, status, url) {
FROM_HERE, base::Bind(arg0, status, url));
}
ACTION(InvokeCompletionClosure) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(arg0));
}
class SyncFileSystemServiceTest : public testing::Test {
protected:
SyncFileSystemServiceTest()
......@@ -349,6 +354,9 @@ TEST_F(SyncFileSystemServiceTest, SimpleLocalSyncFlow) {
ApplyLocalChange(change, _, _, kFile, _))
.WillOnce(MockStatusCallback(SYNC_STATUS_OK));
EXPECT_CALL(*mock_remote_service(), PromoteDemotedChanges(_))
.WillRepeatedly(InvokeCompletionClosure());
EXPECT_EQ(base::File::FILE_OK, file_system_->CreateFile(kFile));
run_loop.Run();
......@@ -398,6 +406,9 @@ TEST_F(SyncFileSystemServiceTest, SimpleSyncFlowWithFileBusy) {
.WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
}
EXPECT_CALL(*mock_remote_service(), PromoteDemotedChanges(_))
.WillRepeatedly(InvokeCompletionClosure());
// We might also see an activity for local sync as we're going to make
// a local write operation on kFile.
EXPECT_CALL(*mock_local_change_processor(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment