| 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_initializer.
h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.
h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); | 50 in_memory_env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); |
| 51 | 51 |
| 52 scoped_ptr<drive::DriveServiceInterface> | 52 scoped_ptr<drive::DriveServiceInterface> |
| 53 fake_drive_service(new drive::FakeDriveService); | 53 fake_drive_service(new drive::FakeDriveService); |
| 54 | 54 |
| 55 sync_context_.reset(new SyncEngineContext( | 55 sync_context_.reset(new SyncEngineContext( |
| 56 fake_drive_service.Pass(), | 56 fake_drive_service.Pass(), |
| 57 scoped_ptr<drive::DriveUploaderInterface>(), | 57 scoped_ptr<drive::DriveUploaderInterface>(), |
| 58 NULL, | 58 NULL, |
| 59 base::ThreadTaskRunnerHandle::Get(), | 59 base::ThreadTaskRunnerHandle::Get(), |
| 60 base::ThreadTaskRunnerHandle::Get(), | |
| 61 base::ThreadTaskRunnerHandle::Get())); | 60 base::ThreadTaskRunnerHandle::Get())); |
| 62 | 61 |
| 63 sync_task_manager_.reset(new SyncTaskManager( | 62 sync_task_manager_.reset(new SyncTaskManager( |
| 64 base::WeakPtr<SyncTaskManager::Client>(), | 63 base::WeakPtr<SyncTaskManager::Client>(), |
| 65 1 /* maximum_parallel_task */, | 64 1 /* maximum_parallel_task */, |
| 66 base::ThreadTaskRunnerHandle::Get())); | 65 base::ThreadTaskRunnerHandle::Get())); |
| 67 sync_task_manager_->Initialize(SYNC_STATUS_OK); | 66 sync_task_manager_->Initialize(SYNC_STATUS_OK); |
| 68 } | 67 } |
| 69 | 68 |
| 70 virtual void TearDown() OVERRIDE { | 69 virtual void TearDown() OVERRIDE { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 103 } |
| 105 | 104 |
| 106 SyncStatusCode PopulateDatabase( | 105 SyncStatusCode PopulateDatabase( |
| 107 const google_apis::FileResource& sync_root, | 106 const google_apis::FileResource& sync_root, |
| 108 const google_apis::FileResource** app_roots, | 107 const google_apis::FileResource** app_roots, |
| 109 size_t app_roots_count) { | 108 size_t app_roots_count) { |
| 110 SyncStatusCode status = SYNC_STATUS_UNKNOWN; | 109 SyncStatusCode status = SYNC_STATUS_UNKNOWN; |
| 111 scoped_ptr<MetadataDatabase> database; | 110 scoped_ptr<MetadataDatabase> database; |
| 112 MetadataDatabase::Create( | 111 MetadataDatabase::Create( |
| 113 base::ThreadTaskRunnerHandle::Get(), | 112 base::ThreadTaskRunnerHandle::Get(), |
| 114 base::ThreadTaskRunnerHandle::Get(), | |
| 115 database_path(), | 113 database_path(), |
| 116 in_memory_env_.get(), | 114 in_memory_env_.get(), |
| 117 CreateResultReceiver(&status, &database)); | 115 CreateResultReceiver(&status, &database)); |
| 118 base::RunLoop().RunUntilIdle(); | 116 base::RunLoop().RunUntilIdle(); |
| 119 if (status != SYNC_STATUS_OK) | 117 if (status != SYNC_STATUS_OK) |
| 120 return status; | 118 return status; |
| 121 | 119 |
| 122 // |app_root_list| must not own the resources here. Be sure to call | 120 // |app_root_list| must not own the resources here. Be sure to call |
| 123 // weak_clear later. | 121 // weak_clear later. |
| 124 ScopedVector<google_apis::FileResource> app_root_list; | 122 ScopedVector<google_apis::FileResource> app_root_list; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 350 |
| 353 EXPECT_EQ(0u, CountTrackersForFile(sync_root->file_id())); | 351 EXPECT_EQ(0u, CountTrackersForFile(sync_root->file_id())); |
| 354 EXPECT_FALSE(HasNoParent(sync_root->file_id())); | 352 EXPECT_FALSE(HasNoParent(sync_root->file_id())); |
| 355 | 353 |
| 356 EXPECT_EQ(1u, CountFileMetadata()); | 354 EXPECT_EQ(1u, CountFileMetadata()); |
| 357 EXPECT_EQ(1u, CountFileTracker()); | 355 EXPECT_EQ(1u, CountFileTracker()); |
| 358 } | 356 } |
| 359 | 357 |
| 360 } // namespace drive_backend | 358 } // namespace drive_backend |
| 361 } // namespace sync_file_system | 359 } // namespace sync_file_system |
| OLD | NEW |