#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "google_apis/drive/drive_api_requests.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <utility>
#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/test/task_environment.h"
#include "base/test/values_test_util.h"
#include "base/time/time.h"
#include "base/values.h"
#include "google_apis/common/base_requests.h"
#include "google_apis/common/dummy_auth_service.h"
#include "google_apis/common/request_sender.h"
#include "google_apis/common/test_util.h"
#include "google_apis/drive/drive_api_parser.h"
#include "google_apis/drive/drive_api_url_generator.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/network_service.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/fake_test_cert_verifier_params_factory.h"
#include "services/network/test/test_network_context_client.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace google_apis {
namespace {
const char kTestETag[] = …;
const char kTestUserAgent[] = …;
const char kTestChildrenResponse[] = …;
const char kTestPermissionResponse[] = …;
const char kTestUploadExistingFilePath[] = …;
const char kTestUploadNewFilePath[] = …;
const char kTestDownloadPathPrefix[] = …;
const char kTestDownloadFileQuery[] = …;
void AppendContent(std::string* out,
ApiErrorCode error,
std::unique_ptr<std::string> content,
bool first_chunk) { … }
class TestBatchableDelegate : public BatchableDelegate { … };
}
class DriveApiRequestsTest : public testing::Test { … };
TEST_F(DriveApiRequestsTest, DriveApiDataRequest_Fields) { … }
TEST_F(DriveApiRequestsTest, FilesInsertRequest) { … }
TEST_F(DriveApiRequestsTest, FilesPatchRequest) { … }
TEST_F(DriveApiRequestsTest, AboutGetRequest_ValidJson) { … }
TEST_F(DriveApiRequestsTest, AboutGetRequest_InvalidJson) { … }
TEST_F(DriveApiRequestsTest, ChangesListRequest) { … }
TEST_F(DriveApiRequestsTest, ChangesListNextPageRequest) { … }
TEST_F(DriveApiRequestsTest, FilesCopyRequest) { … }
TEST_F(DriveApiRequestsTest, FilesCopyRequest_EmptyParentResourceId) { … }
TEST_F(DriveApiRequestsTest, TeamDriveListRequest) { … }
TEST_F(DriveApiRequestsTest, StartPageTokenRequest) { … }
TEST_F(DriveApiRequestsTest, FilesListRequest) { … }
TEST_F(DriveApiRequestsTest, FilesListNextPageRequest) { … }
TEST_F(DriveApiRequestsTest, FilesDeleteRequest) { … }
TEST_F(DriveApiRequestsTest, FilesTrashRequest) { … }
TEST_F(DriveApiRequestsTest, ChildrenInsertRequest) { … }
TEST_F(DriveApiRequestsTest, ChildrenDeleteRequest) { … }
TEST_F(DriveApiRequestsTest, UploadNewFileRequest) { … }
TEST_F(DriveApiRequestsTest, UploadNewEmptyFileRequest) { … }
TEST_F(DriveApiRequestsTest, UploadNewLargeFileRequest) { … }
TEST_F(DriveApiRequestsTest, UploadNewFileWithMetadataRequest) { … }
TEST_F(DriveApiRequestsTest, UploadExistingFileRequest) { … }
TEST_F(DriveApiRequestsTest, UploadExistingFileRequestWithETag) { … }
TEST_F(DriveApiRequestsTest, UploadExistingFileRequestWithETagConflicting) { … }
TEST_F(DriveApiRequestsTest,
UploadExistingFileRequestWithETagConflictOnResumeUpload) { … }
TEST_F(DriveApiRequestsTest, UploadExistingFileWithMetadataRequest) { … }
TEST_F(DriveApiRequestsTest, DownloadFileRequest) { … }
TEST_F(DriveApiRequestsTest, DownloadFileRequest_GetContentCallback) { … }
TEST_F(DriveApiRequestsTest, PermissionsInsertRequest) { … }
TEST_F(DriveApiRequestsTest, BatchUploadRequest) { … }
TEST_F(DriveApiRequestsTest, BatchUploadRequestWithBodyIncludingZero) { … }
TEST_F(DriveApiRequestsTest, BatchUploadRequestProgress) { … }
TEST(ParseMultipartResponseTest, Empty) { … }
TEST(ParseMultipartResponseTest, Basic) { … }
TEST(ParseMultipartResponseTest, InvalidStatusLine) { … }
TEST(ParseMultipartResponseTest, BoundaryInTheBodyAndPreamble) { … }
TEST(ParseMultipartResponseTest, QuatedBoundary) { … }
TEST(ParseMultipartResponseTest, BoundaryWithTransportPadding) { … }
}