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"
8 #include "chrome/browser/drive/drive_api_util.h"
10 using google_apis::AboutResourceCallback
;
11 using google_apis::AppListCallback
;
12 using google_apis::AuthStatusCallback
;
13 using google_apis::AuthorizeAppCallback
;
14 using google_apis::CancelCallback
;
15 using google_apis::DownloadActionCallback
;
16 using google_apis::EntryActionCallback
;
17 using google_apis::GetContentCallback
;
18 using google_apis::GetResourceEntryCallback
;
19 using google_apis::GetResourceListCallback
;
20 using google_apis::GetShareUrlCallback
;
21 using google_apis::InitiateUploadCallback
;
22 using google_apis::ProgressCallback
;
23 using google_apis::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 ResourceIdCanonicalizer
DummyDriveService::GetResourceIdCanonicalizer() const {
40 return util::GetIdentityResourceIdCanonicalizer();
43 bool DummyDriveService::HasAccessToken() const { return true; }
45 void DummyDriveService::RequestAccessToken(const AuthStatusCallback
& callback
) {
46 callback
.Run(google_apis::HTTP_NOT_MODIFIED
, "fake_access_token");
49 bool DummyDriveService::HasRefreshToken() const { return true; }
51 void DummyDriveService::ClearAccessToken() { }
53 void DummyDriveService::ClearRefreshToken() { }
55 std::string
DummyDriveService::GetRootResourceId() const {
59 CancelCallback
DummyDriveService::GetAllResourceList(
60 const GetResourceListCallback
& callback
) { return CancelCallback(); }
62 CancelCallback
DummyDriveService::GetResourceListInDirectory(
63 const std::string
& directory_resource_id
,
64 const GetResourceListCallback
& callback
) { return CancelCallback(); }
66 CancelCallback
DummyDriveService::Search(
67 const std::string
& search_query
,
68 const GetResourceListCallback
& callback
) { return CancelCallback(); }
70 CancelCallback
DummyDriveService::SearchByTitle(
71 const std::string
& title
,
72 const std::string
& directory_resource_id
,
73 const GetResourceListCallback
& callback
) { return CancelCallback(); }
75 CancelCallback
DummyDriveService::GetChangeList(
76 int64 start_changestamp
,
77 const GetResourceListCallback
& callback
) { return CancelCallback(); }
79 CancelCallback
DummyDriveService::GetRemainingChangeList(
80 const GURL
& next_link
,
81 const GetResourceListCallback
& callback
) { return CancelCallback(); }
83 CancelCallback
DummyDriveService::GetRemainingFileList(
84 const GURL
& next_link
,
85 const GetResourceListCallback
& callback
) { return CancelCallback(); }
87 CancelCallback
DummyDriveService::GetResourceEntry(
88 const std::string
& resource_id
,
89 const GetResourceEntryCallback
& callback
) { return CancelCallback(); }
91 CancelCallback
DummyDriveService::GetShareUrl(
92 const std::string
& resource_id
,
93 const GURL
& embed_origin
,
94 const GetShareUrlCallback
& callback
) { return CancelCallback(); }
96 CancelCallback
DummyDriveService::GetAboutResource(
97 const AboutResourceCallback
& callback
) { return CancelCallback(); }
99 CancelCallback
DummyDriveService::GetAppList(
100 const AppListCallback
& callback
) { return CancelCallback(); }
102 CancelCallback
DummyDriveService::DeleteResource(
103 const std::string
& resource_id
,
104 const std::string
& etag
,
105 const EntryActionCallback
& callback
) { return CancelCallback(); }
107 CancelCallback
DummyDriveService::TrashResource(
108 const std::string
& resource_id
,
109 const EntryActionCallback
& callback
) { return CancelCallback(); }
111 CancelCallback
DummyDriveService::DownloadFile(
112 const base::FilePath
& local_cache_path
,
113 const std::string
& resource_id
,
114 const DownloadActionCallback
& download_action_callback
,
115 const GetContentCallback
& get_content_callback
,
116 const ProgressCallback
& progress_callback
) { return CancelCallback(); }
118 CancelCallback
DummyDriveService::CopyResource(
119 const std::string
& resource_id
,
120 const std::string
& parent_resource_id
,
121 const std::string
& new_title
,
122 const base::Time
& last_modified
,
123 const GetResourceEntryCallback
& callback
) { return CancelCallback(); }
125 CancelCallback
DummyDriveService::UpdateResource(
126 const std::string
& resource_id
,
127 const std::string
& parent_resource_id
,
128 const std::string
& new_title
,
129 const base::Time
& last_modified
,
130 const base::Time
& last_viewed_by_me
,
131 const google_apis::GetResourceEntryCallback
& callback
) {
132 return CancelCallback();
135 CancelCallback
DummyDriveService::RenameResource(
136 const std::string
& resource_id
,
137 const std::string
& new_title
,
138 const EntryActionCallback
& callback
) { return CancelCallback(); }
140 CancelCallback
DummyDriveService::AddResourceToDirectory(
141 const std::string
& parent_resource_id
,
142 const std::string
& resource_id
,
143 const EntryActionCallback
& callback
) { return CancelCallback(); }
145 CancelCallback
DummyDriveService::RemoveResourceFromDirectory(
146 const std::string
& parent_resource_id
,
147 const std::string
& resource_id
,
148 const EntryActionCallback
& callback
) { return CancelCallback(); }
150 CancelCallback
DummyDriveService::AddNewDirectory(
151 const std::string
& parent_resource_id
,
152 const std::string
& directory_title
,
153 const AddNewDirectoryOptions
& options
,
154 const GetResourceEntryCallback
& callback
) { return CancelCallback(); }
156 CancelCallback
DummyDriveService::InitiateUploadNewFile(
157 const std::string
& content_type
,
158 int64 content_length
,
159 const std::string
& parent_resource_id
,
160 const std::string
& title
,
161 const InitiateUploadNewFileOptions
& options
,
162 const InitiateUploadCallback
& callback
) { return CancelCallback(); }
164 CancelCallback
DummyDriveService::InitiateUploadExistingFile(
165 const std::string
& content_type
,
166 int64 content_length
,
167 const std::string
& resource_id
,
168 const InitiateUploadExistingFileOptions
& options
,
169 const InitiateUploadCallback
& callback
) { return CancelCallback(); }
171 CancelCallback
DummyDriveService::ResumeUpload(
172 const GURL
& upload_url
,
173 int64 start_position
,
175 int64 content_length
,
176 const std::string
& content_type
,
177 const base::FilePath
& local_file_path
,
178 const UploadRangeCallback
& callback
,
179 const ProgressCallback
& progress_callback
) { return CancelCallback(); }
181 CancelCallback
DummyDriveService::GetUploadStatus(
182 const GURL
& upload_url
,
183 int64 content_length
,
184 const UploadRangeCallback
& callback
) { return CancelCallback(); }
186 CancelCallback
DummyDriveService::AuthorizeApp(
187 const std::string
& resource_id
,
188 const std::string
& app_id
,
189 const AuthorizeAppCallback
& callback
) { return CancelCallback(); }
191 CancelCallback
DummyDriveService::UninstallApp(
192 const std::string
& app_id
,
193 const EntryActionCallback
& callback
) { return CancelCallback(); }
195 CancelCallback
DummyDriveService::GetResourceListInDirectoryByWapi(
196 const std::string
& directory_resource_id
,
197 const GetResourceListCallback
& callback
) { return CancelCallback(); }
199 CancelCallback
DummyDriveService::GetRemainingResourceList(
200 const GURL
& next_link
,
201 const GetResourceListCallback
& callback
) { return CancelCallback(); }