| 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/fake_drive_service_helpe
r.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/fake_drive_service_helpe
r.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_, &temp_file)); | 250 EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_, &temp_file)); |
| 251 fake_drive_service_->DownloadFile( | 251 fake_drive_service_->DownloadFile( |
| 252 temp_file, file->resource_id(), | 252 temp_file, file->resource_id(), |
| 253 base::Bind(&DownloadResultCallback, &error), | 253 base::Bind(&DownloadResultCallback, &error), |
| 254 google_apis::GetContentCallback(), | 254 google_apis::GetContentCallback(), |
| 255 google_apis::ProgressCallback()); | 255 google_apis::ProgressCallback()); |
| 256 FlushMessageLoop(); | 256 FlushMessageLoop(); |
| 257 if (error != google_apis::HTTP_SUCCESS) | 257 if (error != google_apis::HTTP_SUCCESS) |
| 258 return error; | 258 return error; |
| 259 | 259 |
| 260 return file_util::ReadFileToString(temp_file, file_content) | 260 return base::ReadFileToString(temp_file, file_content) |
| 261 ? google_apis::HTTP_SUCCESS : google_apis::GDATA_FILE_ERROR; | 261 ? google_apis::HTTP_SUCCESS : google_apis::GDATA_FILE_ERROR; |
| 262 } | 262 } |
| 263 | 263 |
| 264 GDataErrorCode FakeDriveServiceHelper::CompleteListing( | 264 GDataErrorCode FakeDriveServiceHelper::CompleteListing( |
| 265 scoped_ptr<ResourceList> list, | 265 scoped_ptr<ResourceList> list, |
| 266 ScopedVector<ResourceEntry>* entries) { | 266 ScopedVector<ResourceEntry>* entries) { |
| 267 while (true) { | 267 while (true) { |
| 268 entries->reserve(entries->size() + list->entries().size()); | 268 entries->reserve(entries->size() + list->entries().size()); |
| 269 for (ScopedVector<ResourceEntry>::iterator itr = | 269 for (ScopedVector<ResourceEntry>::iterator itr = |
| 270 list->mutable_entries()->begin(); | 270 list->mutable_entries()->begin(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 305 } |
| 306 | 306 |
| 307 void FakeDriveServiceHelper::FlushMessageLoop() { | 307 void FakeDriveServiceHelper::FlushMessageLoop() { |
| 308 base::MessageLoop::current()->RunUntilIdle(); | 308 base::MessageLoop::current()->RunUntilIdle(); |
| 309 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 309 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
| 310 base::MessageLoop::current()->RunUntilIdle(); | 310 base::MessageLoop::current()->RunUntilIdle(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 } // namespace drive_backend | 313 } // namespace drive_backend |
| 314 } // namespace sync_file_system | 314 } // namespace sync_file_system |
| OLD | NEW |