| 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 13 matching lines...) Expand all Loading... |
| 24 namespace drive_backend { | 24 namespace drive_backend { |
| 25 | 25 |
| 26 class SyncEngineTest : public testing::Test, | 26 class SyncEngineTest : public testing::Test, |
| 27 public base::SupportsWeakPtr<SyncEngineTest> { | 27 public base::SupportsWeakPtr<SyncEngineTest> { |
| 28 public: | 28 public: |
| 29 typedef RemoteFileSyncService::OriginStatusMap RemoteOriginStatusMap; | 29 typedef RemoteFileSyncService::OriginStatusMap RemoteOriginStatusMap; |
| 30 | 30 |
| 31 SyncEngineTest() {} | 31 SyncEngineTest() {} |
| 32 virtual ~SyncEngineTest() {} | 32 virtual ~SyncEngineTest() {} |
| 33 | 33 |
| 34 virtual void SetUp() OVERRIDE { | 34 virtual void SetUp() override { |
| 35 ASSERT_TRUE(profile_dir_.CreateUniqueTempDir()); | 35 ASSERT_TRUE(profile_dir_.CreateUniqueTempDir()); |
| 36 | 36 |
| 37 scoped_ptr<drive::DriveServiceInterface> | 37 scoped_ptr<drive::DriveServiceInterface> |
| 38 fake_drive_service(new drive::FakeDriveService); | 38 fake_drive_service(new drive::FakeDriveService); |
| 39 | 39 |
| 40 worker_pool_ = new base::SequencedWorkerPool(1, "Worker"); | 40 worker_pool_ = new base::SequencedWorkerPool(1, "Worker"); |
| 41 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = | 41 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = |
| 42 base::ThreadTaskRunnerHandle::Get(); | 42 base::ThreadTaskRunnerHandle::Get(); |
| 43 worker_task_runner_ = | 43 worker_task_runner_ = |
| 44 worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( | 44 worker_pool_->GetSequencedTaskRunnerWithShutdownBehavior( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 62 sync_engine_->InitializeForTesting( | 62 sync_engine_->InitializeForTesting( |
| 63 fake_drive_service.Pass(), | 63 fake_drive_service.Pass(), |
| 64 nullptr, // drive_uploader | 64 nullptr, // drive_uploader |
| 65 scoped_ptr<SyncWorkerInterface>(new FakeSyncWorker)); | 65 scoped_ptr<SyncWorkerInterface>(new FakeSyncWorker)); |
| 66 sync_engine_->SetSyncEnabled(true); | 66 sync_engine_->SetSyncEnabled(true); |
| 67 sync_engine_->OnReadyToSendRequests(); | 67 sync_engine_->OnReadyToSendRequests(); |
| 68 | 68 |
| 69 WaitForWorkerTaskRunner(); | 69 WaitForWorkerTaskRunner(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 virtual void TearDown() OVERRIDE { | 72 virtual void TearDown() override { |
| 73 sync_engine_.reset(); | 73 sync_engine_.reset(); |
| 74 WaitForWorkerTaskRunner(); | 74 WaitForWorkerTaskRunner(); |
| 75 worker_pool_->Shutdown(); | 75 worker_pool_->Shutdown(); |
| 76 | 76 |
| 77 worker_task_runner_ = nullptr; | 77 worker_task_runner_ = nullptr; |
| 78 worker_pool_ = nullptr; | 78 worker_pool_ = nullptr; |
| 79 | 79 |
| 80 base::RunLoop().RunUntilIdle(); | 80 base::RunLoop().RunUntilIdle(); |
| 81 } | 81 } |
| 82 | 82 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 TEST_F(SyncEngineTest, ProcessRemoteChange) { | 229 TEST_F(SyncEngineTest, ProcessRemoteChange) { |
| 230 SyncStatusCode sync_status; | 230 SyncStatusCode sync_status; |
| 231 storage::FileSystemURL url; | 231 storage::FileSystemURL url; |
| 232 sync_engine()->ProcessRemoteChange(CreateResultReceiver(&sync_status, &url)); | 232 sync_engine()->ProcessRemoteChange(CreateResultReceiver(&sync_status, &url)); |
| 233 WaitForWorkerTaskRunner(); | 233 WaitForWorkerTaskRunner(); |
| 234 EXPECT_EQ(SYNC_STATUS_OK, sync_status); | 234 EXPECT_EQ(SYNC_STATUS_OK, sync_status); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace drive_backend | 237 } // namespace drive_backend |
| 238 } // namespace sync_file_system | 238 } // namespace sync_file_system |
| OLD | NEW |