Commit 8ff7bba2 authored by Dominique Fauteux-Chapleau's avatar Dominique Fauteux-Chapleau Committed by Commit Bot

Add checks for events in DeepScanningDialogDelegate browsertests

Bug: 1059780
Change-Id: I75f74fcd70eee7fbd61a6a32aa9104e148b4d9fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2102637Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
Commit-Queue: Dominique Fauteux-Chapleau <domfc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750643}
parent 349d2557
...@@ -659,6 +659,12 @@ void SafeBrowsingPrivateEventRouter::SetCloudPolicyClientForTesting( ...@@ -659,6 +659,12 @@ void SafeBrowsingPrivateEventRouter::SetCloudPolicyClientForTesting(
client_ = client; client_ = client;
} }
void SafeBrowsingPrivateEventRouter::SetBinaryUploadServiceForTesting(
safe_browsing::BinaryUploadService* binary_upload_service) {
DCHECK_EQ(nullptr, binary_upload_service_);
binary_upload_service_ = binary_upload_service;
}
void SafeBrowsingPrivateEventRouter::InitRealtimeReportingClient() { void SafeBrowsingPrivateEventRouter::InitRealtimeReportingClient() {
// If already initialized, do nothing. // If already initialized, do nothing.
if (client_) { if (client_) {
......
...@@ -194,6 +194,9 @@ class SafeBrowsingPrivateEventRouter : public KeyedService { ...@@ -194,6 +194,9 @@ class SafeBrowsingPrivateEventRouter : public KeyedService {
void SetCloudPolicyClientForTesting(policy::CloudPolicyClient* client); void SetCloudPolicyClientForTesting(policy::CloudPolicyClient* client);
void SetBinaryUploadServiceForTesting(
safe_browsing::BinaryUploadService* binary_upload_service);
protected: protected:
// Callback to report safe browsing event through real-time reporting channel, // Callback to report safe browsing event through real-time reporting channel,
// if the browser is authorized to do so. Declared as protected to be called // if the browser is authorized to do so. Declared as protected to be called
......
...@@ -83,6 +83,9 @@ void DeepScanningBrowserTestBase::TearDownOnMainThread() { ...@@ -83,6 +83,9 @@ void DeepScanningBrowserTestBase::TearDownOnMainThread() {
SetWaitPolicy(DelayDeliveryUntilVerdictValues::DELAY_NONE); SetWaitPolicy(DelayDeliveryUntilVerdictValues::DELAY_NONE);
SetAllowPasswordProtectedFilesPolicy( SetAllowPasswordProtectedFilesPolicy(
AllowPasswordProtectedFilesValues::ALLOW_UPLOADS_AND_DOWNLOADS); AllowPasswordProtectedFilesValues::ALLOW_UPLOADS_AND_DOWNLOADS);
SetBlockUnsupportedFileTypesPolicy(
BlockUnsupportedFiletypesValues::BLOCK_UNSUPPORTED_FILETYPES_NONE);
SetUnsafeEventsReportingPolicy(false);
} }
void DeepScanningBrowserTestBase::SetDlpPolicy( void DeepScanningBrowserTestBase::SetDlpPolicy(
...@@ -115,6 +118,11 @@ void DeepScanningBrowserTestBase::SetBlockUnsupportedFileTypesPolicy( ...@@ -115,6 +118,11 @@ void DeepScanningBrowserTestBase::SetBlockUnsupportedFileTypesPolicy(
prefs::kBlockUnsupportedFiletypes, state); prefs::kBlockUnsupportedFiletypes, state);
} }
void DeepScanningBrowserTestBase::SetUnsafeEventsReportingPolicy(bool report) {
g_browser_process->local_state()->SetBoolean(
prefs::kUnsafeEventsReportingEnabled, report);
}
void DeepScanningBrowserTestBase::SetUpDelegate() { void DeepScanningBrowserTestBase::SetUpDelegate() {
SetDMTokenForTesting(policy::DMToken::CreateValidTokenForTesting(kDmToken)); SetDMTokenForTesting(policy::DMToken::CreateValidTokenForTesting(kDmToken));
DeepScanningDialogDelegate::SetFactoryForTesting(base::BindRepeating( DeepScanningDialogDelegate::SetFactoryForTesting(base::BindRepeating(
......
...@@ -28,6 +28,7 @@ class DeepScanningBrowserTestBase : public InProcessBrowserTest { ...@@ -28,6 +28,7 @@ class DeepScanningBrowserTestBase : public InProcessBrowserTest {
AllowPasswordProtectedFilesValues state); AllowPasswordProtectedFilesValues state);
void SetBlockUnsupportedFileTypesPolicy( void SetBlockUnsupportedFileTypesPolicy(
BlockUnsupportedFiletypesValues state); BlockUnsupportedFiletypesValues state);
void SetUnsafeEventsReportingPolicy(bool report);
// Sets up a FakeDeepScanningDialogDelegate to use this class's StatusCallback // Sets up a FakeDeepScanningDialogDelegate to use this class's StatusCallback
// and EncryptionStatusCallback. Also sets up a test DM token. // and EncryptionStatusCallback. Also sets up a test DM token.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment