#include "chrome/browser/safe_browsing/cloud_content_scanning/file_analysis_request.h"
#include "base/containers/span.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback_helpers.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/gmock_callback_support.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "build/build_config.h"
#include "chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.h"
#include "chrome/browser/enterprise/connectors/common.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h"
#include "chrome/common/chrome_paths.h"
#include "components/enterprise/connectors/core/service_provider_config.h"
#include "components/file_access/scoped_file_access.h"
#include "components/file_access/scoped_file_access_delegate.h"
#include "components/file_access/test/mock_scoped_file_access_delegate.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace safe_browsing {
namespace {
BinaryUploadService::ContentAnalysisCallback DoNothingConnector() { … }
bool IsDocMimeType(const std::string& mime_type) { … }
bool IsZipMimeType(const std::string& mime_type) { … }
}
class FileAnalysisRequestTest : public testing::Test { … };
TEST_F(FileAnalysisRequestTest, InvalidFiles) { … }
TEST_F(FileAnalysisRequestTest, NormalFiles) { … }
TEST_F(FileAnalysisRequestTest, NormalFilesDataControls) { … }
#if BUILDFLAG(IS_MAC)
#define MAYBE_LargeFiles …
#else
#define MAYBE_LargeFiles …
#endif
TEST_F(FileAnalysisRequestTest, MAYBE_LargeFiles) { … }
TEST_F(FileAnalysisRequestTest, PopulatesDigest) { … }
TEST_F(FileAnalysisRequestTest, PopulatesFilename) { … }
TEST_F(FileAnalysisRequestTest, CachesResults) { … }
TEST_F(FileAnalysisRequestTest, CachesResultsWithKnownMimetype) { … }
TEST_F(FileAnalysisRequestTest, DelayedFileOpening) { … }
TEST_F(FileAnalysisRequestTest, SuccessWithCorrectPassword) { … }
TEST_F(FileAnalysisRequestTest, FileEncryptedWithIncorrectPassword) { … }
class FileAnalysisRequestZipTest
: public FileAnalysisRequestTest,
public testing::WithParamInterface<const char*> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(FileAnalysisRequestZipTest, Encrypted) { … }
}