Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.cc

Issue 18506002: drive/syncFS: Switch to ID based download URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase! Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/api_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 9 #include "base/message_loop.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 GDataErrorCode error = GetResourceEntry(file_id, &file); 242 GDataErrorCode error = GetResourceEntry(file_id, &file);
243 if (error != google_apis::HTTP_SUCCESS) 243 if (error != google_apis::HTTP_SUCCESS)
244 return error; 244 return error;
245 if (!file) 245 if (!file)
246 return google_apis::GDATA_PARSE_ERROR; 246 return google_apis::GDATA_PARSE_ERROR;
247 247
248 error = google_apis::GDATA_OTHER_ERROR; 248 error = google_apis::GDATA_OTHER_ERROR;
249 base::FilePath temp_file; 249 base::FilePath temp_file;
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->download_url(), 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 file_util::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 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 305
306 void FakeDriveServiceHelper::FlushMessageLoop() { 306 void FakeDriveServiceHelper::FlushMessageLoop() {
307 base::MessageLoop::current()->RunUntilIdle(); 307 base::MessageLoop::current()->RunUntilIdle();
308 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 308 content::BrowserThread::GetBlockingPool()->FlushForTesting();
309 base::MessageLoop::current()->RunUntilIdle(); 309 base::MessageLoop::current()->RunUntilIdle();
310 } 310 }
311 311
312 } // namespace drive_backend 312 } // namespace drive_backend
313 } // namespace sync_file_system 313 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/api_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698