| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_file_system/drive_backend/sync_engine.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 worker_pool_ = new base::SequencedWorkerPool(1, "Worker"); | 39 worker_pool_ = new base::SequencedWorkerPool(1, "Worker"); |
| 40 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = | 40 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = |
| 41 base::ThreadTaskRunnerHandle::Get(); | 41 base::ThreadTaskRunnerHandle::Get(); |
| 42 worker_task_runner_ = | 42 worker_task_runner_ = |
| 43 worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( | 43 worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( |
| 44 worker_pool_->GetSequenceToken(), | 44 worker_pool_->GetSequenceToken(), |
| 45 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); | 45 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); |
| 46 | 46 |
| 47 sync_engine_.reset(new drive_backend::SyncEngine( | 47 sync_engine_.reset(new drive_backend::SyncEngine( |
| 48 ui_task_runner, | 48 ui_task_runner.get(), |
| 49 worker_task_runner_, | 49 worker_task_runner_.get(), |
| 50 NULL /* drive_task_runner */, | 50 NULL /* drive_task_runner */, |
| 51 profile_dir_.path(), | 51 profile_dir_.path(), |
| 52 NULL /* task_logger */, | 52 NULL /* task_logger */, |
| 53 NULL /* notification_manager */, | 53 NULL /* notification_manager */, |
| 54 NULL /* extension_service */, | 54 NULL /* extension_service */, |
| 55 NULL /* signin_manager */, | 55 NULL /* signin_manager */, |
| 56 NULL /* token_service */, | 56 NULL /* token_service */, |
| 57 NULL /* request_context */, | 57 NULL /* request_context */, |
| 58 scoped_ptr<SyncEngine::DriveServiceFactory>(), | 58 scoped_ptr<SyncEngine::DriveServiceFactory>(), |
| 59 NULL /* in_memory_env */)); | 59 NULL /* in_memory_env */)); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 worker_task_runner_->PostTask( | 96 worker_task_runner_->PostTask( |
| 97 FROM_HERE, | 97 FROM_HERE, |
| 98 base::Bind(&FakeSyncWorker::UpdateServiceState, | 98 base::Bind(&FakeSyncWorker::UpdateServiceState, |
| 99 base::Unretained(fake_sync_worker()), | 99 base::Unretained(fake_sync_worker()), |
| 100 state, | 100 state, |
| 101 description)); | 101 description)); |
| 102 WaitForWorkerTaskRunner(); | 102 WaitForWorkerTaskRunner(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void WaitForWorkerTaskRunner() { | 105 void WaitForWorkerTaskRunner() { |
| 106 DCHECK(worker_task_runner_); | 106 DCHECK(worker_task_runner_.get()); |
| 107 | 107 |
| 108 base::RunLoop run_loop; | 108 base::RunLoop run_loop; |
| 109 worker_task_runner_->PostTask( | 109 worker_task_runner_->PostTask( |
| 110 FROM_HERE, | 110 FROM_HERE, |
| 111 RelayCallbackToCurrentThread( | 111 RelayCallbackToCurrentThread( |
| 112 FROM_HERE, run_loop.QuitClosure())); | 112 FROM_HERE, run_loop.QuitClosure())); |
| 113 run_loop.Run(); | 113 run_loop.Run(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Accessors | 116 // Accessors |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 TEST_F(SyncEngineTest, ProcessRemoteChange) { | 224 TEST_F(SyncEngineTest, ProcessRemoteChange) { |
| 225 SyncStatusCode sync_status; | 225 SyncStatusCode sync_status; |
| 226 storage::FileSystemURL url; | 226 storage::FileSystemURL url; |
| 227 sync_engine()->ProcessRemoteChange(CreateResultReceiver(&sync_status, &url)); | 227 sync_engine()->ProcessRemoteChange(CreateResultReceiver(&sync_status, &url)); |
| 228 WaitForWorkerTaskRunner(); | 228 WaitForWorkerTaskRunner(); |
| 229 EXPECT_EQ(SYNC_STATUS_OK, sync_status); | 229 EXPECT_EQ(SYNC_STATUS_OK, sync_status); |
| 230 } | 230 } |
| 231 | 231 |
| 232 } // namespace drive_backend | 232 } // namespace drive_backend |
| 233 } // namespace sync_file_system | 233 } // namespace sync_file_system |
| OLD | NEW |