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 #ifndef COMPONENTS_DRIVE_SERVICE_DUMMY_DRIVE_SERVICE_H_
6 #define COMPONENTS_DRIVE_SERVICE_DUMMY_DRIVE_SERVICE_H_
10 #include "components/drive/service/drive_service_interface.h"
11 #include "google_apis/drive/auth_service_interface.h"
15 // Dummy implementation of DriveServiceInterface.
16 // All functions do nothing, or return place holder values like 'true'.
17 class DummyDriveService
: public DriveServiceInterface
{
20 ~DummyDriveService() override
;
22 // DriveServiceInterface Overrides
23 void Initialize(const std::string
& account_id
) override
;
24 void AddObserver(DriveServiceObserver
* observer
) override
;
25 void RemoveObserver(DriveServiceObserver
* observer
) override
;
26 bool CanSendRequest() const override
;
27 bool HasAccessToken() const override
;
28 void RequestAccessToken(
29 const google_apis::AuthStatusCallback
& callback
) override
;
30 bool HasRefreshToken() const override
;
31 void ClearAccessToken() override
;
32 void ClearRefreshToken() override
;
33 std::string
GetRootResourceId() const override
;
34 google_apis::CancelCallback
GetAllFileList(
35 const google_apis::FileListCallback
& callback
) override
;
36 google_apis::CancelCallback
GetFileListInDirectory(
37 const std::string
& directory_resource_id
,
38 const google_apis::FileListCallback
& callback
) override
;
39 google_apis::CancelCallback
Search(
40 const std::string
& search_query
,
41 const google_apis::FileListCallback
& callback
) override
;
42 google_apis::CancelCallback
SearchByTitle(
43 const std::string
& title
,
44 const std::string
& directory_resource_id
,
45 const google_apis::FileListCallback
& callback
) override
;
46 google_apis::CancelCallback
GetChangeList(
47 int64 start_changestamp
,
48 const google_apis::ChangeListCallback
& callback
) override
;
49 google_apis::CancelCallback
GetRemainingChangeList(
50 const GURL
& next_link
,
51 const google_apis::ChangeListCallback
& callback
) override
;
52 google_apis::CancelCallback
GetRemainingFileList(
53 const GURL
& next_link
,
54 const google_apis::FileListCallback
& callback
) override
;
55 google_apis::CancelCallback
GetFileResource(
56 const std::string
& resource_id
,
57 const google_apis::FileResourceCallback
& callback
) override
;
58 google_apis::CancelCallback
GetShareUrl(
59 const std::string
& resource_id
,
60 const GURL
& embed_origin
,
61 const google_apis::GetShareUrlCallback
& callback
) override
;
62 google_apis::CancelCallback
GetAboutResource(
63 const google_apis::AboutResourceCallback
& callback
) override
;
64 google_apis::CancelCallback
GetAppList(
65 const google_apis::AppListCallback
& callback
) override
;
66 google_apis::CancelCallback
DeleteResource(
67 const std::string
& resource_id
,
68 const std::string
& etag
,
69 const google_apis::EntryActionCallback
& callback
) override
;
70 google_apis::CancelCallback
TrashResource(
71 const std::string
& resource_id
,
72 const google_apis::EntryActionCallback
& callback
) override
;
73 google_apis::CancelCallback
DownloadFile(
74 const base::FilePath
& local_cache_path
,
75 const std::string
& resource_id
,
76 const google_apis::DownloadActionCallback
& download_action_callback
,
77 const google_apis::GetContentCallback
& get_content_callback
,
78 const google_apis::ProgressCallback
& progress_callback
) override
;
79 google_apis::CancelCallback
CopyResource(
80 const std::string
& resource_id
,
81 const std::string
& parent_resource_id
,
82 const std::string
& new_title
,
83 const base::Time
& last_modified
,
84 const google_apis::FileResourceCallback
& callback
) override
;
85 google_apis::CancelCallback
UpdateResource(
86 const std::string
& resource_id
,
87 const std::string
& parent_resource_id
,
88 const std::string
& new_title
,
89 const base::Time
& last_modified
,
90 const base::Time
& last_viewed_by_me
,
91 const google_apis::drive::Properties
& properties
,
92 const google_apis::FileResourceCallback
& callback
) override
;
93 google_apis::CancelCallback
AddResourceToDirectory(
94 const std::string
& parent_resource_id
,
95 const std::string
& resource_id
,
96 const google_apis::EntryActionCallback
& callback
) override
;
97 google_apis::CancelCallback
RemoveResourceFromDirectory(
98 const std::string
& parent_resource_id
,
99 const std::string
& resource_id
,
100 const google_apis::EntryActionCallback
& callback
) override
;
101 google_apis::CancelCallback
AddNewDirectory(
102 const std::string
& parent_resource_id
,
103 const std::string
& directory_title
,
104 const AddNewDirectoryOptions
& options
,
105 const google_apis::FileResourceCallback
& callback
) override
;
106 google_apis::CancelCallback
InitiateUploadNewFile(
107 const std::string
& content_type
,
108 int64 content_length
,
109 const std::string
& parent_resource_id
,
110 const std::string
& title
,
111 const UploadNewFileOptions
& options
,
112 const google_apis::InitiateUploadCallback
& callback
) override
;
113 google_apis::CancelCallback
InitiateUploadExistingFile(
114 const std::string
& content_type
,
115 int64 content_length
,
116 const std::string
& resource_id
,
117 const UploadExistingFileOptions
& options
,
118 const google_apis::InitiateUploadCallback
& callback
) override
;
119 google_apis::CancelCallback
ResumeUpload(
120 const GURL
& upload_url
,
121 int64 start_position
,
123 int64 content_length
,
124 const std::string
& content_type
,
125 const base::FilePath
& local_file_path
,
126 const google_apis::drive::UploadRangeCallback
& callback
,
127 const google_apis::ProgressCallback
& progress_callback
) override
;
128 google_apis::CancelCallback
GetUploadStatus(
129 const GURL
& upload_url
,
130 int64 content_length
,
131 const google_apis::drive::UploadRangeCallback
& callback
) override
;
132 google_apis::CancelCallback
MultipartUploadNewFile(
133 const std::string
& content_type
,
134 int64 content_length
,
135 const std::string
& parent_resource_id
,
136 const std::string
& title
,
137 const base::FilePath
& local_file_path
,
138 const UploadNewFileOptions
& options
,
139 const google_apis::FileResourceCallback
& callback
,
140 const google_apis::ProgressCallback
& progress_callback
) override
;
141 google_apis::CancelCallback
MultipartUploadExistingFile(
142 const std::string
& content_type
,
143 int64 content_length
,
144 const std::string
& resource_id
,
145 const base::FilePath
& local_file_path
,
146 const UploadExistingFileOptions
& options
,
147 const google_apis::FileResourceCallback
& callback
,
148 const google_apis::ProgressCallback
& progress_callback
) override
;
149 google_apis::CancelCallback
AuthorizeApp(
150 const std::string
& resource_id
,
151 const std::string
& app_id
,
152 const google_apis::AuthorizeAppCallback
& callback
) override
;
153 google_apis::CancelCallback
UninstallApp(
154 const std::string
& app_id
,
155 const google_apis::EntryActionCallback
& callback
) override
;
156 google_apis::CancelCallback
AddPermission(
157 const std::string
& resource_id
,
158 const std::string
& email
,
159 google_apis::drive::PermissionRole role
,
160 const google_apis::EntryActionCallback
& callback
) override
;
161 scoped_ptr
<BatchRequestConfiguratorInterface
> StartBatchRequest() override
;
166 #endif // COMPONENTS_DRIVE_SERVICE_DUMMY_DRIVE_SERVICE_H_