1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/drive/dummy_drive_service.h"
9 using google_apis::AboutResourceCallback
;
10 using google_apis::AppListCallback
;
11 using google_apis::AuthStatusCallback
;
12 using google_apis::AuthorizeAppCallback
;
13 using google_apis::CancelCallback
;
14 using google_apis::ChangeListCallback
;
15 using google_apis::DownloadActionCallback
;
16 using google_apis::EntryActionCallback
;
17 using google_apis::FileListCallback
;
18 using google_apis::FileResourceCallback
;
19 using google_apis::GetContentCallback
;
20 using google_apis::GetShareUrlCallback
;
21 using google_apis::InitiateUploadCallback
;
22 using google_apis::ProgressCallback
;
23 using google_apis::drive::UploadRangeCallback
;
27 DummyDriveService::DummyDriveService() {}
29 DummyDriveService::~DummyDriveService() {}
31 void DummyDriveService::Initialize(const std::string
& account_id
) {}
33 void DummyDriveService::AddObserver(DriveServiceObserver
* observer
) {}
35 void DummyDriveService::RemoveObserver(DriveServiceObserver
* observer
) {}
37 bool DummyDriveService::CanSendRequest() const { return true; }
39 bool DummyDriveService::HasAccessToken() const { return true; }
41 void DummyDriveService::RequestAccessToken(const AuthStatusCallback
& callback
) {
42 callback
.Run(google_apis::HTTP_NOT_MODIFIED
, "fake_access_token");
45 bool DummyDriveService::HasRefreshToken() const { return true; }
47 void DummyDriveService::ClearAccessToken() { }
49 void DummyDriveService::ClearRefreshToken() { }
51 std::string
DummyDriveService::GetRootResourceId() const {
55 CancelCallback
DummyDriveService::GetAllFileList(
56 const FileListCallback
& callback
) { return CancelCallback(); }
58 CancelCallback
DummyDriveService::GetFileListInDirectory(
59 const std::string
& directory_resource_id
,
60 const FileListCallback
& callback
) { return CancelCallback(); }
62 CancelCallback
DummyDriveService::Search(
63 const std::string
& search_query
,
64 const FileListCallback
& callback
) { return CancelCallback(); }
66 CancelCallback
DummyDriveService::SearchByTitle(
67 const std::string
& title
,
68 const std::string
& directory_resource_id
,
69 const FileListCallback
& callback
) { return CancelCallback(); }
71 CancelCallback
DummyDriveService::GetChangeList(
72 int64 start_changestamp
,
73 const ChangeListCallback
& callback
) { return CancelCallback(); }
75 CancelCallback
DummyDriveService::GetRemainingChangeList(
76 const GURL
& next_link
,
77 const ChangeListCallback
& callback
) { return CancelCallback(); }
79 CancelCallback
DummyDriveService::GetRemainingFileList(
80 const GURL
& next_link
,
81 const FileListCallback
& callback
) { return CancelCallback(); }
83 CancelCallback
DummyDriveService::GetFileResource(
84 const std::string
& resource_id
,
85 const FileResourceCallback
& callback
) { return CancelCallback(); }
87 CancelCallback
DummyDriveService::GetShareUrl(
88 const std::string
& resource_id
,
89 const GURL
& embed_origin
,
90 const GetShareUrlCallback
& callback
) { return CancelCallback(); }
92 CancelCallback
DummyDriveService::GetAboutResource(
93 const AboutResourceCallback
& callback
) { return CancelCallback(); }
95 CancelCallback
DummyDriveService::GetAppList(
96 const AppListCallback
& callback
) { return CancelCallback(); }
98 CancelCallback
DummyDriveService::DeleteResource(
99 const std::string
& resource_id
,
100 const std::string
& etag
,
101 const EntryActionCallback
& callback
) { return CancelCallback(); }
103 CancelCallback
DummyDriveService::TrashResource(
104 const std::string
& resource_id
,
105 const EntryActionCallback
& callback
) { return CancelCallback(); }
107 CancelCallback
DummyDriveService::DownloadFile(
108 const base::FilePath
& local_cache_path
,
109 const std::string
& resource_id
,
110 const DownloadActionCallback
& download_action_callback
,
111 const GetContentCallback
& get_content_callback
,
112 const ProgressCallback
& progress_callback
) { return CancelCallback(); }
114 CancelCallback
DummyDriveService::CopyResource(
115 const std::string
& resource_id
,
116 const std::string
& parent_resource_id
,
117 const std::string
& new_title
,
118 const base::Time
& last_modified
,
119 const FileResourceCallback
& callback
) { return CancelCallback(); }
121 CancelCallback
DummyDriveService::UpdateResource(
122 const std::string
& resource_id
,
123 const std::string
& parent_resource_id
,
124 const std::string
& new_title
,
125 const base::Time
& last_modified
,
126 const base::Time
& last_viewed_by_me
,
127 const google_apis::drive::Properties
& properties
,
128 const google_apis::FileResourceCallback
& callback
) {
129 return CancelCallback();
132 CancelCallback
DummyDriveService::AddResourceToDirectory(
133 const std::string
& parent_resource_id
,
134 const std::string
& resource_id
,
135 const EntryActionCallback
& callback
) { return CancelCallback(); }
137 CancelCallback
DummyDriveService::RemoveResourceFromDirectory(
138 const std::string
& parent_resource_id
,
139 const std::string
& resource_id
,
140 const EntryActionCallback
& callback
) { return CancelCallback(); }
142 CancelCallback
DummyDriveService::AddNewDirectory(
143 const std::string
& parent_resource_id
,
144 const std::string
& directory_title
,
145 const AddNewDirectoryOptions
& options
,
146 const FileResourceCallback
& callback
) { return CancelCallback(); }
148 CancelCallback
DummyDriveService::InitiateUploadNewFile(
149 const std::string
& content_type
,
150 int64 content_length
,
151 const std::string
& parent_resource_id
,
152 const std::string
& title
,
153 const UploadNewFileOptions
& options
,
154 const InitiateUploadCallback
& callback
) {
155 return CancelCallback();
158 CancelCallback
DummyDriveService::InitiateUploadExistingFile(
159 const std::string
& content_type
,
160 int64 content_length
,
161 const std::string
& resource_id
,
162 const UploadExistingFileOptions
& options
,
163 const InitiateUploadCallback
& callback
) {
164 return CancelCallback();
167 CancelCallback
DummyDriveService::ResumeUpload(
168 const GURL
& upload_url
,
169 int64 start_position
,
171 int64 content_length
,
172 const std::string
& content_type
,
173 const base::FilePath
& local_file_path
,
174 const UploadRangeCallback
& callback
,
175 const ProgressCallback
& progress_callback
) { return CancelCallback(); }
177 CancelCallback
DummyDriveService::GetUploadStatus(
178 const GURL
& upload_url
,
179 int64 content_length
,
180 const UploadRangeCallback
& callback
) { return CancelCallback(); }
182 CancelCallback
DummyDriveService::MultipartUploadNewFile(
183 const std::string
& content_type
,
184 int64 content_length
,
185 const std::string
& parent_resource_id
,
186 const std::string
& title
,
187 const base::FilePath
& local_file_path
,
188 const UploadNewFileOptions
& options
,
189 const FileResourceCallback
& callback
,
190 const ProgressCallback
& progress_callback
) {
191 return CancelCallback();
194 CancelCallback
DummyDriveService::MultipartUploadExistingFile(
195 const std::string
& content_type
,
196 int64 content_length
,
197 const std::string
& resource_id
,
198 const base::FilePath
& local_file_path
,
199 const UploadExistingFileOptions
& options
,
200 const FileResourceCallback
& callback
,
201 const ProgressCallback
& progress_callback
) {
202 return CancelCallback();
205 CancelCallback
DummyDriveService::AuthorizeApp(
206 const std::string
& resource_id
,
207 const std::string
& app_id
,
208 const AuthorizeAppCallback
& callback
) { return CancelCallback(); }
210 CancelCallback
DummyDriveService::UninstallApp(
211 const std::string
& app_id
,
212 const EntryActionCallback
& callback
) { return CancelCallback(); }
214 CancelCallback
DummyDriveService::AddPermission(
215 const std::string
& resource_id
,
216 const std::string
& email
,
217 google_apis::drive::PermissionRole role
,
218 const EntryActionCallback
& callback
) { return CancelCallback(); }
219 scoped_ptr
<BatchRequestConfiguratorInterface
>
220 DummyDriveService::StartBatchRequest() {
221 return scoped_ptr
<BatchRequestConfiguratorInterface
>();