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"
13 #include "google_apis/drive/gdata_wapi_parser.h"
19 namespace sync_file_system
{
20 namespace drive_backend
{
22 class FakeDriveServiceHelper
{
24 FakeDriveServiceHelper(drive::FakeDriveService
* fake_drive_service
,
25 drive::DriveUploaderInterface
* drive_uploader
,
26 const std::string
& sync_root_folder_title
);
27 virtual ~FakeDriveServiceHelper();
29 google_apis::GDataErrorCode
AddOrphanedFolder(
30 const std::string
& title
,
31 std::string
* folder_id
);
32 google_apis::GDataErrorCode
AddFolder(
33 const std::string
& parent_folder_id
,
34 const std::string
& title
,
35 std::string
* folder_id
);
36 google_apis::GDataErrorCode
AddFile(
37 const std::string
& parent_folder_id
,
38 const std::string
& title
,
39 const std::string
& content
,
40 std::string
* file_id
);
41 google_apis::GDataErrorCode
UpdateFile(
42 const std::string
& file_id
,
43 const std::string
& content
);
44 google_apis::GDataErrorCode
DeleteResource(
45 const std::string
& file_id
);
46 google_apis::GDataErrorCode
TrashResource(
47 const std::string
& file_id
);
48 google_apis::GDataErrorCode
UpdateModificationTime(
49 const std::string
& file_id
,
50 const base::Time
& modification_time
);
51 google_apis::GDataErrorCode
RenameResource(
52 const std::string
& file_id
,
53 const std::string
& new_title
);
54 google_apis::GDataErrorCode
AddResourceToDirectory(
55 const std::string
& parent_folder_id
,
56 const std::string
& file_id
);
57 google_apis::GDataErrorCode
RemoveResourceFromDirectory(
58 const std::string
& parent_folder_id
,
59 const std::string
& file_id
);
60 google_apis::GDataErrorCode
GetSyncRootFolderID(
61 std::string
* sync_root_folder_id
);
62 google_apis::GDataErrorCode
ListFilesInFolder(
63 const std::string
& folder_id
,
64 ScopedVector
<google_apis::ResourceEntry
>* entries
);
65 google_apis::GDataErrorCode
SearchByTitle(
66 const std::string
& folder_id
,
67 const std::string
& title
,
68 ScopedVector
<google_apis::ResourceEntry
>* entries
);
69 google_apis::GDataErrorCode
GetFileResource(
70 const std::string
& file_id
,
71 scoped_ptr
<google_apis::FileResource
>* entry
);
72 google_apis::GDataErrorCode
ReadFile(
73 const std::string
& file_id
,
74 std::string
* file_content
);
75 google_apis::GDataErrorCode
GetAboutResource(
76 scoped_ptr
<google_apis::AboutResource
>* about_resource
);
78 base::FilePath
base_dir_path() { return base_dir_
.path(); }
81 google_apis::GDataErrorCode
CompleteListing(
82 scoped_ptr
<google_apis::FileList
> list
,
83 ScopedVector
<google_apis::ResourceEntry
>* 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_