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 =
DeepScanningBrowserTestBase::DeepScanningBrowserTestBase() {
// Enable every deep scanning features.
scoped_feature_list_.InitWithFeatures(
{kContentComplianceEnabled, kMalwareScanEnabled,
kDeepScanningOfUploadsUI},
{});
{kContentComplianceEnabled, kMalwareScanEnabled}, {});
// Change the time values of the upload UI to smaller ones to make tests
// showing it run faster.
......
......@@ -50,10 +50,6 @@
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 {
// Global pointer of factory function (RepeatingCallback) used to create
......@@ -205,6 +201,11 @@ bool AllowUnsupportedFileTypes() {
state != BLOCK_UNSUPPORTED_FILETYPES_UPLOADS_AND_DOWNLOADS;
}
bool* UIEnabledStorage() {
static bool enabled = true;
return &enabled;
}
} // namespace
// A BinaryUploadService::Request implementation that gets the data to scan
......@@ -416,9 +417,8 @@ void DeepScanningDialogDelegate::ShowForWebContents(
bool work_being_done = delegate->UploadData();
// Only show UI if work is being done in the background, the user must
// wait for a verdict, and the UI feature is enabled.
bool show_ui = work_being_done && wait_for_verdict &&
base::FeatureList::IsEnabled(kDeepScanningOfUploadsUI);
// wait for a verdict.
bool show_ui = work_being_done && wait_for_verdict && (*UIEnabledStorage());
// If the UI is enabled, create the modal dialog.
if (show_ui) {
......@@ -457,6 +457,11 @@ void DeepScanningDialogDelegate::ResetFactoryForTesting() {
GetFactoryStorage()->Reset();
}
// static
void DeepScanningDialogDelegate::DisableUIForTesting() {
*UIEnabledStorage() = false;
}
DeepScanningDialogDelegate::DeepScanningDialogDelegate(
content::WebContents* web_contents,
Data data,
......
......@@ -31,8 +31,6 @@ namespace safe_browsing {
class DeepScanningDialogViews;
extern const base::Feature kDeepScanningOfUploadsUI;
// 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.
//
......@@ -202,6 +200,9 @@ class DeepScanningDialogDelegate {
static void SetFactoryForTesting(Factory factory);
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
// block it.
static bool ResultShouldAllowDataUse(BinaryUploadService::Result result);
......
......@@ -59,6 +59,7 @@ class BaseTest : public testing::Test {
BaseTest() : profile_manager_(TestingBrowserProcess::GetGlobal()) {
EXPECT_TRUE(profile_manager_.SetUp());
profile_ = profile_manager_.CreateTestingProfile("test-user");
DeepScanningDialogDelegate::DisableUIForTesting();
}
void EnableFeatures(const std::vector<base::Feature>& features) {
......
......@@ -80,6 +80,7 @@ class ChromeWebContentsViewDelegateHandleOnPerformDrop : public testing::Test {
&safe_browsing::FakeDeepScanningDialogDelegate::Create,
run_loop_->QuitClosure(), callback, is_encrypted_callback,
"dm_token"));
safe_browsing::DeepScanningDialogDelegate::DisableUIForTesting();
}
// 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