#include "components/drive/service/fake_drive_service.h"
#include <stddef.h>
#include <stdint.h>
#include <string>
#include <vector>
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/hash/md5.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "components/drive/file_system_core_util.h"
#include "components/drive/service/test_util.h"
#include "google_apis/common/test_util.h"
#include "google_apis/drive/drive_api_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
AboutResource;
ApiErrorCode;
ChangeList;
ChangeResource;
FileList;
FileResource;
GetContentCallback;
HTTP_CREATED;
HTTP_FORBIDDEN;
HTTP_NO_CONTENT;
HTTP_NOT_FOUND;
HTTP_PRECONDITION;
HTTP_RESUME_INCOMPLETE;
HTTP_SUCCESS;
NO_CONNECTION;
OTHER_ERROR;
ProgressCallback;
StartPageToken;
TeamDriveList;
UploadRangeResponse;
namespace drive {
namespace test_util {
AppendProgressCallbackResult;
CreateCopyResultCallback;
ProgressInfo;
TestGetContentCallback;
WriteStringToFile;
}
namespace {
constexpr char TEAM_DRIVE_ID_1[] = …;
constexpr char TEAM_DRIVE_NAME_1[] = …;
constexpr char TEAM_DRIVE_ID_2[] = …;
constexpr char TEAM_DRIVE_NAME_2[] = …;
constexpr char TEAM_DRIVE_ID_3[] = …;
constexpr char TEAM_DRIVE_NAME_3[] = …;
google_apis::FileResourceCapabilities CreateMixedFileCapabilities() { … }
google_apis::TeamDriveCapabilities CreateMixedTeamDriveCapabilities() { … }
void ExpectFileCapabilitiesEqual(
const google_apis::FileResourceCapabilities& expectedCapabilities,
const google_apis::FileResourceCapabilities& actualCapabilities) { … }
void ExpectTeamDriveCapabilitiesEqual(
const google_apis::TeamDriveCapabilities& expectedCapabilities,
const google_apis::TeamDriveCapabilities& actualCapabilities) { … }
class FakeDriveServiceTest : public testing::Test { … };
TEST_F(FakeDriveServiceTest, GetAllFileList) { … }
TEST_F(FakeDriveServiceTest, GetAllFileList_TeamDrives) { … }
TEST_F(FakeDriveServiceTest, GetAllFileList_Offline) { … }
TEST_F(FakeDriveServiceTest, GetFileListInDirectory_InRootDirectory) { … }
TEST_F(FakeDriveServiceTest, GetFileListInDirectory_InNonRootDirectory) { … }
TEST_F(FakeDriveServiceTest, GetFileListInDirectory_Offline) { … }
TEST_F(FakeDriveServiceTest, Search) { … }
TEST_F(FakeDriveServiceTest, Search_WithAttribute) { … }
TEST_F(FakeDriveServiceTest, Search_MultipleQueries) { … }
TEST_F(FakeDriveServiceTest, Search_Offline) { … }
TEST_F(FakeDriveServiceTest, Search_Deleted) { … }
TEST_F(FakeDriveServiceTest, Search_Trashed) { … }
TEST_F(FakeDriveServiceTest, SearchByTitle) { … }
TEST_F(FakeDriveServiceTest, SearchByTitle_EmptyDirectoryResourceId) { … }
TEST_F(FakeDriveServiceTest, SearchByTitle_Offline) { … }
TEST_F(FakeDriveServiceTest, GetChangeList_NoNewEntries) { … }
TEST_F(FakeDriveServiceTest, GetChangeList_WithNewEntry) { … }
TEST_F(FakeDriveServiceTest, GetChangeList_WithNewTeamDrive) { … }
TEST_F(FakeDriveServiceTest, GetChangeList_Offline) { … }
TEST_F(FakeDriveServiceTest, GetChangeList_DeletedEntry) { … }
TEST_F(FakeDriveServiceTest, GetChangeList_TrashedEntry) { … }
TEST_F(FakeDriveServiceTest, GetAllTeamDriveList) { … }
TEST_F(FakeDriveServiceTest, GetRemainingFileList_GetAllFileList) { … }
TEST_F(FakeDriveServiceTest, GetRemainingFileList_GetFileListInDirectory) { … }
TEST_F(FakeDriveServiceTest, GetRemainingFileList_Search) { … }
TEST_F(FakeDriveServiceTest, GetRemainingChangeList_GetChangeList) { … }
TEST_F(FakeDriveServiceTest, GetAboutResource) { … }
TEST_F(FakeDriveServiceTest, GetStartPageToken) { … }
TEST_F(FakeDriveServiceTest, GetStartPageToken_TeamDrive) { … }
TEST_F(FakeDriveServiceTest, GetAboutResource_Offline) { … }
TEST_F(FakeDriveServiceTest, GetFileResource_ExistingFile) { … }
TEST_F(FakeDriveServiceTest, GetFileResource_NonexistingFile) { … }
TEST_F(FakeDriveServiceTest, GetFileResource_Offline) { … }
TEST_F(FakeDriveServiceTest, DeleteResource_ExistingFile) { … }
TEST_F(FakeDriveServiceTest, DeleteResource_NonexistingFile) { … }
TEST_F(FakeDriveServiceTest, DeleteResource_ETagMatch) { … }
TEST_F(FakeDriveServiceTest, DeleteResource_Offline) { … }
TEST_F(FakeDriveServiceTest, DeleteResource_Forbidden) { … }
TEST_F(FakeDriveServiceTest, TrashResource_ExistingFile) { … }
TEST_F(FakeDriveServiceTest, TrashResource_NonexistingFile) { … }
TEST_F(FakeDriveServiceTest, TrashResource_Offline) { … }
TEST_F(FakeDriveServiceTest, TrashResource_Forbidden) { … }
TEST_F(FakeDriveServiceTest, DownloadFile_ExistingFile) { … }
TEST_F(FakeDriveServiceTest, DownloadFile_NonexistingFile) { … }
TEST_F(FakeDriveServiceTest, DownloadFile_Offline) { … }
TEST_F(FakeDriveServiceTest, CopyResource) { … }
TEST_F(FakeDriveServiceTest, CopyResource_NonExisting) { … }
TEST_F(FakeDriveServiceTest, CopyResource_EmptyParentResourceId) { … }
TEST_F(FakeDriveServiceTest, CopyResource_Offline) { … }
TEST_F(FakeDriveServiceTest, UpdateResource) { … }
TEST_F(FakeDriveServiceTest, UpdateResource_NonExisting) { … }
TEST_F(FakeDriveServiceTest, UpdateResource_EmptyParentResourceId) { … }
TEST_F(FakeDriveServiceTest, UpdateResource_Offline) { … }
TEST_F(FakeDriveServiceTest, UpdateResource_Forbidden) { … }
TEST_F(FakeDriveServiceTest, AddResourceToDirectory_FileInRootDirectory) { … }
TEST_F(FakeDriveServiceTest, AddResourceToDirectory_FileInNonRootDirectory) { … }
TEST_F(FakeDriveServiceTest, AddResourceToDirectory_NonexistingFile) { … }
TEST_F(FakeDriveServiceTest, AddResourceToDirectory_OrphanFile) { … }
TEST_F(FakeDriveServiceTest, AddResourceToDirectory_Offline) { … }
TEST_F(FakeDriveServiceTest, RemoveResourceFromDirectory_ExistingFile) { … }
TEST_F(FakeDriveServiceTest, RemoveResourceFromDirectory_NonexistingFile) { … }
TEST_F(FakeDriveServiceTest, RemoveResourceFromDirectory_OrphanFile) { … }
TEST_F(FakeDriveServiceTest, RemoveResourceFromDirectory_Offline) { … }
TEST_F(FakeDriveServiceTest, AddNewDirectory_EmptyParent) { … }
TEST_F(FakeDriveServiceTest, AddNewDirectory_ToRootDirectory) { … }
TEST_F(FakeDriveServiceTest, AddNewDirectory_ToRootDirectoryOnEmptyFileSystem) { … }
TEST_F(FakeDriveServiceTest, AddNewDirectory_ToNonRootDirectory) { … }
TEST_F(FakeDriveServiceTest, AddNewDirectory_ToNonexistingDirectory) { … }
TEST_F(FakeDriveServiceTest, AddNewDirectory_Offline) { … }
TEST_F(FakeDriveServiceTest, InitiateUploadNewFile_Offline) { … }
TEST_F(FakeDriveServiceTest, InitiateUploadNewFile_NotFound) { … }
TEST_F(FakeDriveServiceTest, InitiateUploadNewFile) { … }
TEST_F(FakeDriveServiceTest, InitiateUploadExistingFile_Offline) { … }
TEST_F(FakeDriveServiceTest, InitiateUploadExistingFile_Forbidden) { … }
TEST_F(FakeDriveServiceTest, InitiateUploadExistingFile_NotFound) { … }
TEST_F(FakeDriveServiceTest, InitiateUploadExistingFile_WrongETag) { … }
TEST_F(FakeDriveServiceTest, InitiateUpload_ExistingFile) { … }
TEST_F(FakeDriveServiceTest, ResumeUpload_Offline) { … }
TEST_F(FakeDriveServiceTest, ResumeUpload_NotFound) { … }
TEST_F(FakeDriveServiceTest, ResumeUpload_ExistingFile) { … }
TEST_F(FakeDriveServiceTest, ResumeUpload_NewFile) { … }
TEST_F(FakeDriveServiceTest, AddNewFile_ToRootDirectory) { … }
TEST_F(FakeDriveServiceTest, AddNewFile_ToRootDirectoryOnEmptyFileSystem) { … }
TEST_F(FakeDriveServiceTest, AddNewFile_ToNonRootDirectory) { … }
TEST_F(FakeDriveServiceTest, AddNewFile_ToNonexistingDirectory) { … }
TEST_F(FakeDriveServiceTest, AddNewFile_Offline) { … }
TEST_F(FakeDriveServiceTest, AddNewFile_SharedWithMeLabel) { … }
TEST_F(FakeDriveServiceTest, SetLastModifiedTime_ExistingFile) { … }
TEST_F(FakeDriveServiceTest, SetLastModifiedTime_NonexistingFile) { … }
TEST_F(FakeDriveServiceTest, SetLastModifiedTime_Offline) { … }
TEST_F(FakeDriveServiceTest, SetFileCapabilities_ExistingFile) { … }
TEST_F(FakeDriveServiceTest, SetFileCapabilities_NonexistingFile) { … }
TEST_F(FakeDriveServiceTest, SetFileCapabilities_Offline) { … }
TEST_F(FakeDriveServiceTest, SetTeamDriveCapabilities_ExistingTeamDrive) { … }
}
}