#include "chrome/browser/sync_file_system/drive_backend/fake_drive_service_helper.h"
#include <utility>
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "chrome/browser/sync_file_system/sync_file_system_test_util.h"
#include "chrome/browser/sync_file_system/sync_status_code.h"
#include "google_apis/drive/drive_api_parser.h"
#include "storage/browser/file_system/file_system_url.h"
#include "testing/gtest/include/gtest/gtest.h"
#define FPL(path) …
AboutResource;
ApiErrorCode;
FileList;
FileResource;
namespace sync_file_system {
namespace drive_backend {
namespace {
void UploadResultCallback(ApiErrorCode* error_out,
std::unique_ptr<FileResource>* entry_out,
ApiErrorCode error,
const GURL& upload_location,
std::unique_ptr<FileResource> entry) { … }
void DownloadResultCallback(ApiErrorCode* error_out,
ApiErrorCode error,
const base::FilePath& local_file) { … }
}
FakeDriveServiceHelper::FakeDriveServiceHelper(
drive::FakeDriveService* fake_drive_service,
drive::DriveUploaderInterface* drive_uploader,
const std::string& sync_root_folder_title)
: … { … }
FakeDriveServiceHelper::~FakeDriveServiceHelper() = default;
ApiErrorCode FakeDriveServiceHelper::AddOrphanedFolder(const std::string& title,
std::string* folder_id) { … }
ApiErrorCode FakeDriveServiceHelper::AddFolder(
const std::string& parent_folder_id,
const std::string& title,
std::string* folder_id) { … }
ApiErrorCode FakeDriveServiceHelper::AddFile(
const std::string& parent_folder_id,
const std::string& title,
const std::string& content,
std::string* file_id) { … }
ApiErrorCode FakeDriveServiceHelper::UpdateFile(const std::string& file_id,
const std::string& content) { … }
ApiErrorCode FakeDriveServiceHelper::DeleteResource(
const std::string& file_id) { … }
ApiErrorCode FakeDriveServiceHelper::TrashResource(const std::string& file_id) { … }
ApiErrorCode FakeDriveServiceHelper::UpdateModificationTime(
const std::string& file_id,
const base::Time& modification_time) { … }
ApiErrorCode FakeDriveServiceHelper::RenameResource(
const std::string& file_id,
const std::string& new_title) { … }
ApiErrorCode FakeDriveServiceHelper::AddResourceToDirectory(
const std::string& parent_folder_id,
const std::string& file_id) { … }
ApiErrorCode FakeDriveServiceHelper::RemoveResourceFromDirectory(
const std::string& parent_folder_id,
const std::string& file_id) { … }
ApiErrorCode FakeDriveServiceHelper::GetSyncRootFolderID(
std::string* sync_root_folder_id) { … }
ApiErrorCode FakeDriveServiceHelper::ListFilesInFolder(
const std::string& folder_id,
std::vector<std::unique_ptr<FileResource>>* entries) { … }
ApiErrorCode FakeDriveServiceHelper::SearchByTitle(
const std::string& folder_id,
const std::string& title,
std::vector<std::unique_ptr<FileResource>>* entries) { … }
ApiErrorCode FakeDriveServiceHelper::GetFileResource(
const std::string& file_id,
std::unique_ptr<FileResource>* entry) { … }
ApiErrorCode FakeDriveServiceHelper::GetFileVisibility(
const std::string& file_id,
google_apis::drive::FileVisibility* visibility) { … }
ApiErrorCode FakeDriveServiceHelper::ReadFile(const std::string& file_id,
std::string* file_content) { … }
ApiErrorCode FakeDriveServiceHelper::GetAboutResource(
std::unique_ptr<AboutResource>* about_resource) { … }
ApiErrorCode FakeDriveServiceHelper::CompleteListing(
std::unique_ptr<FileList> list,
std::vector<std::unique_ptr<FileResource>>* entries) { … }
void FakeDriveServiceHelper::Initialize() { … }
base::FilePath FakeDriveServiceHelper::WriteToTempFile(
const std::string& content) { … }
void FakeDriveServiceHelper::AddTeamDrive(const std::string& team_drive_id,
const std::string& team_drive_name) { … }
}
}