#include "chrome/browser/enterprise/connectors/test/fake_content_analysis_delegate.h"
#include <optional>
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/time/time.h"
#include "chrome/browser/enterprise/connectors/test/fake_files_request_handler.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h"
#include "components/enterprise/common/proto/connectors.pb.h"
namespace enterprise_connectors::test {
namespace {
base::TimeDelta response_delay = …;
}
safe_browsing::BinaryUploadService::Result
FakeContentAnalysisDelegate::result_ = …;
bool FakeContentAnalysisDelegate::dialog_shown_ = …;
bool FakeContentAnalysisDelegate::dialog_canceled_ = …;
int64_t FakeContentAnalysisDelegate::total_analysis_requests_count_ = …;
FakeContentAnalysisDelegate::FakeContentAnalysisDelegate(
base::RepeatingClosure delete_closure,
StatusCallback status_callback,
std::string dm_token,
content::WebContents* web_contents,
Data data,
CompletionCallback callback)
: … { … }
FakeContentAnalysisDelegate::~FakeContentAnalysisDelegate() { … }
void FakeContentAnalysisDelegate::SetResponseResult(
safe_browsing::BinaryUploadService::Result result) { … }
void FakeContentAnalysisDelegate::
ResetStaticDialogFlagsAndTotalRequestsCount() { … }
bool FakeContentAnalysisDelegate::WasDialogShown() { … }
bool FakeContentAnalysisDelegate::WasDialogCanceled() { … }
int FakeContentAnalysisDelegate::GetTotalAnalysisRequestsCount() { … }
std::unique_ptr<ContentAnalysisDelegate> FakeContentAnalysisDelegate::Create(
base::RepeatingClosure delete_closure,
StatusCallback status_callback,
std::string dm_token,
content::WebContents* web_contents,
Data data,
CompletionCallback callback) { … }
void FakeContentAnalysisDelegate::SetResponseDelay(base::TimeDelta delay) { … }
ContentAnalysisResponse FakeContentAnalysisDelegate::SuccessfulResponse(
const std::set<std::string>& tags) { … }
ContentAnalysisResponse FakeContentAnalysisDelegate::MalwareResponse(
TriggeredRule::Action action) { … }
ContentAnalysisResponse FakeContentAnalysisDelegate::DlpResponse(
ContentAnalysisResponse::Result::Status status,
const std::string& rule_name,
TriggeredRule::Action action) { … }
ContentAnalysisResponse FakeContentAnalysisDelegate::MalwareAndDlpResponse(
TriggeredRule::Action malware_action,
ContentAnalysisResponse::Result::Status dlp_status,
const std::string& dlp_rule_name,
TriggeredRule::Action dlp_action) { … }
void FakeContentAnalysisDelegate::Response(
std::string contents,
base::FilePath path,
std::unique_ptr<safe_browsing::BinaryUploadService::Request> request,
std::optional<FakeFilesRequestHandler::FakeFileRequestCallback>
file_request_callback,
bool is_image_request) { … }
void FakeContentAnalysisDelegate::UploadTextForDeepScanning(
std::unique_ptr<safe_browsing::BinaryUploadService::Request> request) { … }
void FakeContentAnalysisDelegate::UploadImageForDeepScanning(
std::unique_ptr<safe_browsing::BinaryUploadService::Request> request) { … }
void FakeContentAnalysisDelegate::FakeUploadFileForDeepScanning(
safe_browsing::BinaryUploadService::Result result,
const base::FilePath& path,
std::unique_ptr<safe_browsing::BinaryUploadService::Request> request,
FakeFilesRequestHandler::FakeFileRequestCallback callback) { … }
void FakeContentAnalysisDelegate::UploadPageForDeepScanning(
std::unique_ptr<safe_browsing::BinaryUploadService::Request> request) { … }
bool FakeContentAnalysisDelegate::ShowFinalResultInDialog() { … }
bool FakeContentAnalysisDelegate::CancelDialog() { … }
safe_browsing::BinaryUploadService*
FakeContentAnalysisDelegate::GetBinaryUploadService() { … }
}