#include "components/drive/drive_uploader.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "components/drive/service/dummy_drive_service.h"
#include "google_apis/common/test_util.h"
#include "google_apis/drive/drive_api_parser.h"
#include "testing/gtest/include/gtest/gtest.h"
ApiErrorCode;
CancelCallbackOnce;
FileResource;
HTTP_CONFLICT;
HTTP_CREATED;
HTTP_NOT_FOUND;
HTTP_PRECONDITION;
HTTP_RESUME_INCOMPLETE;
HTTP_SUCCESS;
InitiateUploadCallback;
NO_CONNECTION;
OTHER_ERROR;
ProgressCallback;
UploadRangeResponse;
UploadRangeCallback;
test_util;
namespace drive {
namespace {
const char kTestDummyMd5[] = …;
const char kTestDocumentTitle[] = …;
const char kTestInitiateUploadParentResourceId[] = …;
const char kTestInitiateUploadResourceId[] = …;
const char kTestMimeType[] = …;
const char kTestUploadNewFileURL[] = …;
const char kTestUploadExistingFileURL[] = …;
const int64_t kUploadChunkSize = …;
const char kTestETag[] = …;
CancelCallbackOnce SendMultipartUploadResult(
ApiErrorCode response_code,
int64_t content_length,
google_apis::FileResourceCallback callback,
google_apis::ProgressCallback progress_callback) { … }
class MockDriveServiceWithUploadExpectation : public DummyDriveService { … };
class MockDriveServiceNoConnectionAtInitiate : public DummyDriveService { … };
class MockDriveServiceNoConnectionAtResume : public DummyDriveService { … };
class MockDriveServiceNoConnectionAtGetUploadStatus : public DummyDriveService { … };
class DriveUploaderTest : public testing::Test { … };
}
TEST_F(DriveUploaderTest, UploadExisting0KB) { … }
TEST_F(DriveUploaderTest, UploadExisting512KB) { … }
TEST_F(DriveUploaderTest, UploadExisting2MB) { … }
TEST_F(DriveUploaderTest, InitiateUploadFail) { … }
TEST_F(DriveUploaderTest, MultipartUploadFail) { … }
TEST_F(DriveUploaderTest, InitiateUploadNoConflict) { … }
TEST_F(DriveUploaderTest, MultipartUploadConflict) { … }
TEST_F(DriveUploaderTest, InitiateUploadConflict) { … }
TEST_F(DriveUploaderTest, ResumeUploadFail) { … }
TEST_F(DriveUploaderTest, GetUploadStatusFail) { … }
TEST_F(DriveUploaderTest, NonExistingSourceFile) { … }
TEST_F(DriveUploaderTest, ResumeUpload) { … }
class MockDriveServiceForBatchProcessing : public DummyDriveService { … };
TEST_F(DriveUploaderTest, BatchProcessing) { … }
TEST_F(DriveUploaderTest, BatchProcessingWithError) { … }
}