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

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

Issue 1042803002: Drive: Move inner structures of DriveAPIService under drive namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 5 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_uploader.h" 5 #include "chrome/browser/sync_file_system/drive_backend/fake_drive_uploader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } // namespace 60 } // namespace
61 61
62 FakeDriveServiceWrapper::FakeDriveServiceWrapper() 62 FakeDriveServiceWrapper::FakeDriveServiceWrapper()
63 : make_directory_conflict_(false) {} 63 : make_directory_conflict_(false) {}
64 64
65 FakeDriveServiceWrapper::~FakeDriveServiceWrapper() {} 65 FakeDriveServiceWrapper::~FakeDriveServiceWrapper() {}
66 66
67 CancelCallback FakeDriveServiceWrapper::AddNewDirectory( 67 CancelCallback FakeDriveServiceWrapper::AddNewDirectory(
68 const std::string& parent_resource_id, 68 const std::string& parent_resource_id,
69 const std::string& directory_name, 69 const std::string& directory_name,
70 const AddNewDirectoryOptions& options, 70 const drive::AddNewDirectoryOptions& options,
71 const FileResourceCallback& callback) { 71 const FileResourceCallback& callback) {
72 if (make_directory_conflict_) { 72 if (make_directory_conflict_) {
73 FakeDriveService::AddNewDirectory( 73 FakeDriveService::AddNewDirectory(
74 parent_resource_id, 74 parent_resource_id,
75 directory_name, 75 directory_name,
76 options, 76 options,
77 base::Bind(&DidAddFileOrDirectoryForMakingConflict)); 77 base::Bind(&DidAddFileOrDirectoryForMakingConflict));
78 } 78 }
79 return FakeDriveService::AddNewDirectory( 79 return FakeDriveService::AddNewDirectory(
80 parent_resource_id, directory_name, options, callback); 80 parent_resource_id, directory_name, options, callback);
81 } 81 }
82 82
83 FakeDriveUploader::FakeDriveUploader( 83 FakeDriveUploader::FakeDriveUploader(
84 FakeDriveServiceWrapper* fake_drive_service) 84 FakeDriveServiceWrapper* fake_drive_service)
85 : fake_drive_service_(fake_drive_service), 85 : fake_drive_service_(fake_drive_service),
86 make_file_conflict_(false) {} 86 make_file_conflict_(false) {}
87 87
88 FakeDriveUploader::~FakeDriveUploader() {} 88 FakeDriveUploader::~FakeDriveUploader() {}
89 89
90 CancelCallback FakeDriveUploader::UploadNewFile( 90 CancelCallback FakeDriveUploader::UploadNewFile(
91 const std::string& parent_resource_id, 91 const std::string& parent_resource_id,
92 const base::FilePath& local_file_path, 92 const base::FilePath& local_file_path,
93 const std::string& title, 93 const std::string& title,
94 const std::string& content_type, 94 const std::string& content_type,
95 const UploadNewFileOptions& options, 95 const drive::UploadNewFileOptions& options,
96 const UploadCompletionCallback& callback, 96 const UploadCompletionCallback& callback,
97 const ProgressCallback& progress_callback) { 97 const ProgressCallback& progress_callback) {
98 DCHECK(!callback.is_null()); 98 DCHECK(!callback.is_null());
99 const std::string kFileContent = "test content"; 99 const std::string kFileContent = "test content";
100 100
101 if (make_file_conflict_) { 101 if (make_file_conflict_) {
102 fake_drive_service_->AddNewFile( 102 fake_drive_service_->AddNewFile(
103 content_type, 103 content_type,
104 kFileContent, 104 kFileContent,
105 parent_resource_id, 105 parent_resource_id,
(...skipping 11 matching lines...) Expand all
117 base::Bind(&DidAddFileForUploadNew, callback)); 117 base::Bind(&DidAddFileForUploadNew, callback));
118 base::MessageLoop::current()->RunUntilIdle(); 118 base::MessageLoop::current()->RunUntilIdle();
119 119
120 return CancelCallback(); 120 return CancelCallback();
121 } 121 }
122 122
123 CancelCallback FakeDriveUploader::UploadExistingFile( 123 CancelCallback FakeDriveUploader::UploadExistingFile(
124 const std::string& resource_id, 124 const std::string& resource_id,
125 const base::FilePath& local_file_path, 125 const base::FilePath& local_file_path,
126 const std::string& content_type, 126 const std::string& content_type,
127 const UploadExistingFileOptions& options, 127 const drive::UploadExistingFileOptions& options,
128 const UploadCompletionCallback& callback, 128 const UploadCompletionCallback& callback,
129 const ProgressCallback& progress_callback) { 129 const ProgressCallback& progress_callback) {
130 DCHECK(!callback.is_null()); 130 DCHECK(!callback.is_null());
131 return fake_drive_service_->GetFileResource( 131 return fake_drive_service_->GetFileResource(
132 resource_id, 132 resource_id,
133 base::Bind(&DidGetFileResourceForUploadExisting, callback)); 133 base::Bind(&DidGetFileResourceForUploadExisting, callback));
134 } 134 }
135 135
136 CancelCallback FakeDriveUploader::ResumeUploadFile( 136 CancelCallback FakeDriveUploader::ResumeUploadFile(
137 const GURL& upload_location, 137 const GURL& upload_location,
138 const base::FilePath& local_file_path, 138 const base::FilePath& local_file_path,
139 const std::string& content_type, 139 const std::string& content_type,
140 const UploadCompletionCallback& callback, 140 const drive::UploadCompletionCallback& callback,
141 const ProgressCallback& progress_callback) { 141 const ProgressCallback& progress_callback) {
142 // At the moment, sync file system doesn't support resuming of the uploading. 142 // At the moment, sync file system doesn't support resuming of the uploading.
143 // So this method shouldn't be reached. 143 // So this method shouldn't be reached.
144 NOTREACHED(); 144 NOTREACHED();
145 return CancelCallback(); 145 return CancelCallback();
146 } 146 }
147 147
148 } // namespace drive_backend 148 } // namespace drive_backend
149 } // namespace sync_file_system 149 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698