#include "chrome/browser/safe_browsing/cloud_content_scanning/resumable_uploader.h"
#include <memory>
#include "base/containers/span.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "chrome/browser/enterprise/connectors/test/uploader_test_utils.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/connector_upload_request.h"
#include "content/public/test/browser_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "services/network/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace safe_browsing {
constexpr char kUploadUrl[] = …;
_;
class MockResumableUploadRequest : public ResumableUploadRequest { … };
class ResumableUploadRequestTest : public testing::Test { … };
TEST_F(ResumableUploadRequestTest,
GeneratesCorrectMetadataHeaders_FileRequest) { … }
TEST_F(ResumableUploadRequestTest,
GeneratesCorrectMetadataHeaders_FileRequest_TooLarge) { … }
TEST_F(ResumableUploadRequestTest,
GeneratesCorrectMetadataHeaders_FileRequest_Encrypted) { … }
TEST_F(ResumableUploadRequestTest,
GeneratesCorrectMetadataHeaders_PageRequest) { … }
class ResumableUploadSendMetadataRequestTest
: public ResumableUploadRequestTest,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ResumableUploadSendMetadataRequestTest, SendsCorrectRequest) { … }
TEST_P(ResumableUploadSendMetadataRequestTest, HandlesFailedMetadataScan) { … }
TEST_P(ResumableUploadSendMetadataRequestTest,
HandlesSuccessfulMetadataOnlyScan) { … }
class ResumableUploadSendContentRequestTest
: public ResumableUploadRequestTest,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ResumableUploadSendContentRequestTest, HandlesSuccessfulContentScan) { … }
TEST_P(ResumableUploadSendContentRequestTest, HandlesFileTooLarge) { … }
TEST_P(ResumableUploadSendContentRequestTest, HandlesEncryptedFile) { … }
TEST_P(ResumableUploadSendContentRequestTest, HandlesFailedContentScan) { … }
}