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
GetSyncRootFolderID(
49 std::string
* sync_root_folder_id
);
50 google_apis::GDataErrorCode
ListFilesInFolder(
51 const std::string
& folder_id
,
52 ScopedVector
<google_apis::ResourceEntry
>* entries
);
53 google_apis::GDataErrorCode
SearchByTitle(
54 const std::string
& folder_id
,
55 const std::string
& title
,
56 ScopedVector
<google_apis::ResourceEntry
>* entries
);
57 google_apis::GDataErrorCode
GetResourceEntry(
58 const std::string
& file_id
,
59 scoped_ptr
<google_apis::ResourceEntry
>* entry
);
60 google_apis::GDataErrorCode
ReadFile(
61 const std::string
& file_id
,
62 std::string
* file_content
);
63 google_apis::GDataErrorCode
GetAboutResource(
64 scoped_ptr
<google_apis::AboutResource
>* about_resource
);
66 base::FilePath
base_dir_path() { return base_dir_
.path(); }
69 google_apis::GDataErrorCode
CompleteListing(
70 scoped_ptr
<google_apis::ResourceList
> list
,
71 ScopedVector
<google_apis::ResourceEntry
> * entries
);
75 base::FilePath
WriteToTempFile(const std::string
& content
);
77 base::ScopedTempDir base_dir_
;
78 base::FilePath temp_dir_
;
81 drive::FakeDriveService
* fake_drive_service_
;
82 drive::DriveUploaderInterface
* drive_uploader_
;
84 std::string sync_root_folder_title_
;
87 } // namespace drive_backend
88 } // namespace sync_file_system
90 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_FAKE_DRIVE_SERVICE_HELPER_H_