| 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 "components/drive/file_system/operation_test_base.h" | 5 #include "components/drive/file_system/operation_test_base.h" |
| 6 | 6 |
| 7 #include "base/threading/sequenced_worker_pool.h" | 7 #include "base/threading/sequenced_worker_pool.h" |
| 8 #include "components/drive/chromeos/change_list_loader.h" | 8 #include "components/drive/chromeos/change_list_loader.h" |
| 9 #include "components/drive/chromeos/fake_free_disk_space_getter.h" | 9 #include "components/drive/chromeos/fake_free_disk_space_getter.h" |
| 10 #include "components/drive/chromeos/file_cache.h" | 10 #include "components/drive/chromeos/file_cache.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 change_list_loader_->LoadIfNeeded( | 138 change_list_loader_->LoadIfNeeded( |
| 139 google_apis::test_util::CreateCopyResultCallback(&error)); | 139 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 140 content::RunAllBlockingPoolTasksUntilIdle(); | 140 content::RunAllBlockingPoolTasksUntilIdle(); |
| 141 ASSERT_EQ(FILE_ERROR_OK, error); | 141 ASSERT_EQ(FILE_ERROR_OK, error); |
| 142 } | 142 } |
| 143 | 143 |
| 144 FileError OperationTestBase::GetLocalResourceEntry(const base::FilePath& path, | 144 FileError OperationTestBase::GetLocalResourceEntry(const base::FilePath& path, |
| 145 ResourceEntry* entry) { | 145 ResourceEntry* entry) { |
| 146 FileError error = FILE_ERROR_FAILED; | 146 FileError error = FILE_ERROR_FAILED; |
| 147 base::PostTaskAndReplyWithResult( | 147 base::PostTaskAndReplyWithResult( |
| 148 blocking_task_runner(), | 148 blocking_task_runner(), FROM_HERE, |
| 149 FROM_HERE, | |
| 150 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath, | 149 base::Bind(&internal::ResourceMetadata::GetResourceEntryByPath, |
| 151 base::Unretained(metadata()), path, entry), | 150 base::Unretained(metadata()), path, entry), |
| 152 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error))); | 151 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 153 content::RunAllBlockingPoolTasksUntilIdle(); | 152 content::RunAllBlockingPoolTasksUntilIdle(); |
| 154 return error; | 153 return error; |
| 155 } | 154 } |
| 156 | 155 |
| 157 FileError OperationTestBase::GetLocalResourceEntryById( | 156 FileError OperationTestBase::GetLocalResourceEntryById( |
| 158 const std::string& local_id, | 157 const std::string& local_id, |
| 159 ResourceEntry* entry) { | 158 ResourceEntry* entry) { |
| 160 FileError error = FILE_ERROR_FAILED; | 159 FileError error = FILE_ERROR_FAILED; |
| 161 base::PostTaskAndReplyWithResult( | 160 base::PostTaskAndReplyWithResult( |
| 162 blocking_task_runner(), | 161 blocking_task_runner(), FROM_HERE, |
| 163 FROM_HERE, | |
| 164 base::Bind(&internal::ResourceMetadata::GetResourceEntryById, | 162 base::Bind(&internal::ResourceMetadata::GetResourceEntryById, |
| 165 base::Unretained(metadata()), local_id, entry), | 163 base::Unretained(metadata()), local_id, entry), |
| 166 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error))); | 164 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 167 content::RunAllBlockingPoolTasksUntilIdle(); | 165 content::RunAllBlockingPoolTasksUntilIdle(); |
| 168 return error; | 166 return error; |
| 169 } | 167 } |
| 170 | 168 |
| 171 std::string OperationTestBase::GetLocalId(const base::FilePath& path) { | 169 std::string OperationTestBase::GetLocalId(const base::FilePath& path) { |
| 172 std::string local_id; | 170 std::string local_id; |
| 173 FileError error = FILE_ERROR_FAILED; | 171 FileError error = FILE_ERROR_FAILED; |
| 174 base::PostTaskAndReplyWithResult( | 172 base::PostTaskAndReplyWithResult( |
| 175 blocking_task_runner(), | 173 blocking_task_runner(), FROM_HERE, |
| 176 FROM_HERE, | |
| 177 base::Bind(&internal::ResourceMetadata::GetIdByPath, | 174 base::Bind(&internal::ResourceMetadata::GetIdByPath, |
| 178 base::Unretained(metadata()), path, &local_id), | 175 base::Unretained(metadata()), path, &local_id), |
| 179 base::Bind(google_apis::test_util::CreateCopyResultCallback(&error))); | 176 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 180 content::RunAllBlockingPoolTasksUntilIdle(); | 177 content::RunAllBlockingPoolTasksUntilIdle(); |
| 181 EXPECT_EQ(FILE_ERROR_OK, error) << path.value(); | 178 EXPECT_EQ(FILE_ERROR_OK, error) << path.value(); |
| 182 return local_id; | 179 return local_id; |
| 183 } | 180 } |
| 184 | 181 |
| 185 FileError OperationTestBase::CheckForUpdates() { | 182 FileError OperationTestBase::CheckForUpdates() { |
| 186 FileError error = FILE_ERROR_FAILED; | 183 FileError error = FILE_ERROR_FAILED; |
| 187 change_list_loader_->CheckForUpdates( | 184 change_list_loader_->CheckForUpdates( |
| 188 google_apis::test_util::CreateCopyResultCallback(&error)); | 185 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 189 content::RunAllBlockingPoolTasksUntilIdle(); | 186 content::RunAllBlockingPoolTasksUntilIdle(); |
| 190 return error; | 187 return error; |
| 191 } | 188 } |
| 192 | 189 |
| 193 } // namespace file_system | 190 } // namespace file_system |
| 194 } // namespace drive | 191 } // namespace drive |
| OLD | NEW |