Commit 51295ec2 authored by Dominique Fauteux-Chapleau's avatar Dominique Fauteux-Chapleau Committed by Commit Bot

Remove DeepScanningOfUploadsUI feature flag

That feature flag is no longer necessary since showing the UI should
now be the default behavior. The one exception to this are unit tests,
so this CL adds DeepScanningDialogDelegate::DisableUIForTesting to
handle that case.

Bug: 1058002
Change-Id: Ie823b3635139c89b844e796a7aa3498ebae1d6d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2081630Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Dominique Fauteux-Chapleau <domfc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746886}
parent cda3c78c
...@@ -29,9 +29,7 @@ constexpr base::TimeDelta kSuccessTimeout = ...@@ -29,9 +29,7 @@ constexpr base::TimeDelta kSuccessTimeout =
DeepScanningBrowserTestBase::DeepScanningBrowserTestBase() { DeepScanningBrowserTestBase::DeepScanningBrowserTestBase() {
// Enable every deep scanning features. // Enable every deep scanning features.
scoped_feature_list_.InitWithFeatures( scoped_feature_list_.InitWithFeatures(
{kContentComplianceEnabled, kMalwareScanEnabled, {kContentComplianceEnabled, kMalwareScanEnabled}, {});
kDeepScanningOfUploadsUI},
{});
// Change the time values of the upload UI to smaller ones to make tests // Change the time values of the upload UI to smaller ones to make tests
// showing it run faster. // showing it run faster.
......
...@@ -50,10 +50,6 @@ ...@@ -50,10 +50,6 @@
namespace safe_browsing { namespace safe_browsing {
// TODO(rogerta): keeping this disabled by default until UX is finalized.
const base::Feature kDeepScanningOfUploadsUI{
"SafeBrowsingDeepScanningOfUploadsUI", base::FEATURE_DISABLED_BY_DEFAULT};
namespace { namespace {
// Global pointer of factory function (RepeatingCallback) used to create // Global pointer of factory function (RepeatingCallback) used to create
...@@ -205,6 +201,11 @@ bool AllowUnsupportedFileTypes() { ...@@ -205,6 +201,11 @@ bool AllowUnsupportedFileTypes() {
state != BLOCK_UNSUPPORTED_FILETYPES_UPLOADS_AND_DOWNLOADS; state != BLOCK_UNSUPPORTED_FILETYPES_UPLOADS_AND_DOWNLOADS;
} }
bool* UIEnabledStorage() {
static bool enabled = true;
return &enabled;
}
} // namespace } // namespace
// A BinaryUploadService::Request implementation that gets the data to scan // A BinaryUploadService::Request implementation that gets the data to scan
...@@ -416,9 +417,8 @@ void DeepScanningDialogDelegate::ShowForWebContents( ...@@ -416,9 +417,8 @@ void DeepScanningDialogDelegate::ShowForWebContents(
bool work_being_done = delegate->UploadData(); bool work_being_done = delegate->UploadData();
// Only show UI if work is being done in the background, the user must // Only show UI if work is being done in the background, the user must
// wait for a verdict, and the UI feature is enabled. // wait for a verdict.
bool show_ui = work_being_done && wait_for_verdict && bool show_ui = work_being_done && wait_for_verdict && (*UIEnabledStorage());
base::FeatureList::IsEnabled(kDeepScanningOfUploadsUI);
// If the UI is enabled, create the modal dialog. // If the UI is enabled, create the modal dialog.
if (show_ui) { if (show_ui) {
...@@ -457,6 +457,11 @@ void DeepScanningDialogDelegate::ResetFactoryForTesting() { ...@@ -457,6 +457,11 @@ void DeepScanningDialogDelegate::ResetFactoryForTesting() {
GetFactoryStorage()->Reset(); GetFactoryStorage()->Reset();
} }
// static
void DeepScanningDialogDelegate::DisableUIForTesting() {
*UIEnabledStorage() = false;
}
DeepScanningDialogDelegate::DeepScanningDialogDelegate( DeepScanningDialogDelegate::DeepScanningDialogDelegate(
content::WebContents* web_contents, content::WebContents* web_contents,
Data data, Data data,
......
...@@ -31,8 +31,6 @@ namespace safe_browsing { ...@@ -31,8 +31,6 @@ namespace safe_browsing {
class DeepScanningDialogViews; class DeepScanningDialogViews;
extern const base::Feature kDeepScanningOfUploadsUI;
// A tab modal dialog delegate that informs the user of a background deep // A tab modal dialog delegate that informs the user of a background deep
// scan happening in the given tab with an option to cancel the operation. // scan happening in the given tab with an option to cancel the operation.
// //
...@@ -202,6 +200,9 @@ class DeepScanningDialogDelegate { ...@@ -202,6 +200,9 @@ class DeepScanningDialogDelegate {
static void SetFactoryForTesting(Factory factory); static void SetFactoryForTesting(Factory factory);
static void ResetFactoryForTesting(); static void ResetFactoryForTesting();
// Showing the UI is not possible in unit tests, call this to disable it.
static void DisableUIForTesting();
// Determines if a request result should be used to allow a data use or to // Determines if a request result should be used to allow a data use or to
// block it. // block it.
static bool ResultShouldAllowDataUse(BinaryUploadService::Result result); static bool ResultShouldAllowDataUse(BinaryUploadService::Result result);
......
...@@ -59,6 +59,7 @@ class BaseTest : public testing::Test { ...@@ -59,6 +59,7 @@ class BaseTest : public testing::Test {
BaseTest() : profile_manager_(TestingBrowserProcess::GetGlobal()) { BaseTest() : profile_manager_(TestingBrowserProcess::GetGlobal()) {
EXPECT_TRUE(profile_manager_.SetUp()); EXPECT_TRUE(profile_manager_.SetUp());
profile_ = profile_manager_.CreateTestingProfile("test-user"); profile_ = profile_manager_.CreateTestingProfile("test-user");
DeepScanningDialogDelegate::DisableUIForTesting();
} }
void EnableFeatures(const std::vector<base::Feature>& features) { void EnableFeatures(const std::vector<base::Feature>& features) {
......
...@@ -80,6 +80,7 @@ class ChromeWebContentsViewDelegateHandleOnPerformDrop : public testing::Test { ...@@ -80,6 +80,7 @@ class ChromeWebContentsViewDelegateHandleOnPerformDrop : public testing::Test {
&safe_browsing::FakeDeepScanningDialogDelegate::Create, &safe_browsing::FakeDeepScanningDialogDelegate::Create,
run_loop_->QuitClosure(), callback, is_encrypted_callback, run_loop_->QuitClosure(), callback, is_encrypted_callback,
"dm_token")); "dm_token"));
safe_browsing::DeepScanningDialogDelegate::DisableUIForTesting();
} }
// Common code for running the test cases. // Common code for running the test cases.
......
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