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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_DRIVE_SERVICE_HELPER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_DRIVE_SERVICE_HELPER_H_
10 #include "base/files/scoped_temp_dir.h"
11 #include "chrome/browser/drive/drive_uploader.h"
12 #include "chrome/browser/drive/fake_drive_service.h"
18 namespace sync_file_system
{
19 namespace drive_backend
{
21 class FakeDriveServiceHelper
{
23 FakeDriveServiceHelper(drive::FakeDriveService
* fake_drive_service
,
24 drive::DriveUploaderInterface
* drive_uploader
,
25 const std::string
& sync_root_folder_title
);
26 virtual ~FakeDriveServiceHelper();
28 google_apis::DriveApiErrorCode
AddOrphanedFolder(
29 const std::string
& title
,
30 std::string
* folder_id
);
31 google_apis::DriveApiErrorCode
AddFolder(
32 const std::string
& parent_folder_id
,
33 const std::string
& title
,
34 std::string
* folder_id
);
35 google_apis::DriveApiErrorCode
AddFile(
36 const std::string
& parent_folder_id
,
37 const std::string
& title
,
38 const std::string
& content
,
39 std::string
* file_id
);
40 google_apis::DriveApiErrorCode
UpdateFile(
41 const std::string
& file_id
,
42 const std::string
& content
);
43 google_apis::DriveApiErrorCode
DeleteResource(
44 const std::string
& file_id
);
45 google_apis::DriveApiErrorCode
TrashResource(
46 const std::string
& file_id
);
47 google_apis::DriveApiErrorCode
UpdateModificationTime(
48 const std::string
& file_id
,
49 const base::Time
& modification_time
);
50 google_apis::DriveApiErrorCode
RenameResource(
51 const std::string
& file_id
,
52 const std::string
& new_title
);
53 google_apis::DriveApiErrorCode
AddResourceToDirectory(
54 const std::string
& parent_folder_id
,
55 const std::string
& file_id
);
56 google_apis::DriveApiErrorCode
RemoveResourceFromDirectory(
57 const std::string
& parent_folder_id
,
58 const std::string
& file_id
);
59 google_apis::DriveApiErrorCode
GetSyncRootFolderID(
60 std::string
* sync_root_folder_id
);
61 google_apis::DriveApiErrorCode
ListFilesInFolder(
62 const std::string
& folder_id
,
63 ScopedVector
<google_apis::FileResource
>* entries
);
64 google_apis::DriveApiErrorCode
SearchByTitle(
65 const std::string
& folder_id
,
66 const std::string
& title
,
67 ScopedVector
<google_apis::FileResource
>* entries
);
69 google_apis::DriveApiErrorCode
GetFileResource(
70 const std::string
& file_id
,
71 scoped_ptr
<google_apis::FileResource
>* entry
);
72 google_apis::DriveApiErrorCode
ReadFile(
73 const std::string
& file_id
,
74 std::string
* file_content
);
75 google_apis::DriveApiErrorCode
GetAboutResource(
76 scoped_ptr
<google_apis::AboutResource
>* about_resource
);
78 base::FilePath
base_dir_path() { return base_dir_
.path(); }
81 google_apis::DriveApiErrorCode
CompleteListing(
82 scoped_ptr
<google_apis::FileList
> list
,
83 ScopedVector
<google_apis::FileResource
>* entries
);
87 base::FilePath
WriteToTempFile(const std::string
& content
);
89 base::ScopedTempDir base_dir_
;
90 base::FilePath temp_dir_
;
93 drive::FakeDriveService
* fake_drive_service_
;
94 drive::DriveUploaderInterface
* drive_uploader_
;
96 std::string sync_root_folder_title_
;
99 } // namespace drive_backend
100 } // namespace sync_file_system
102 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_DRIVE_SERVICE_HELPER_H_