Download later: Add a flag to bypass cellular network check.
Some QA testers may not have mobile data on their testing devices, this
CL adds a flag to bypass the cellular check.
Bug: 1105123,1078454
Change-Id: I56f1036c0c3cfeeaab8bc828d02335dbb207f4e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2295752
Reviewed-by: Shakti Sahu <[email protected]>
Commit-Queue: Xing Liu <[email protected]>
Cr-Commit-Position: refs/heads/master@{#788225}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index ec53a73..d1f6a08 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -3855,6 +3855,11 @@
{"download-later", flag_descriptions::kDownloadLaterName,
flag_descriptions::kDownloadLaterDescription, kOsAndroid,
FEATURE_VALUE_TYPE(download::features::kDownloadLater)},
+
+ {"download-later-debug-on-wifi",
+ flag_descriptions::kDownloadLaterDebugOnWifiName,
+ flag_descriptions::kDownloadLaterDebugOnWifiNameDescription, kOsAndroid,
+ SINGLE_VALUE_TYPE(download::switches::kDownloadLaterDebugOnWifi)},
#endif
{"enable-new-download-backend",
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index c57b23bd..dc4fa71 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -1124,6 +1124,11 @@
bool require_cellular = base::GetFieldTrialParamByFeatureAsBool(
download::features::kDownloadLater,
download::features::kDownloadLaterRequireCellular, true);
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ download::switches::kDownloadLaterDebugOnWifi)) {
+ require_cellular = false;
+ }
+
bool on_cellular = network::NetworkConnectionTracker::IsConnectionCellular(
network::mojom::ConnectionType(
net::NetworkChangeNotifier::GetConnectionType()));
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
index e81a1a4..322dcff 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
@@ -1069,6 +1069,11 @@
"expiry_milestone": 88
},
{
+ "name": "download-later-debug-on-wifi",
+ "owners": [ "xingliu", "dtrainor" ],
+ "expiry_milestone": 88
+ },
+ {
"name": "drag_and_drop",
"owners": [ "//ios/chrome/browser/drag_and_drop/OWNERS" ],
"expiry_milestone": 86
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 556f5c17..8ff79125 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -771,6 +771,11 @@
const char kDownloadLaterName[] = "Enable download later";
const char kDownloadLaterDescription[] = "Enables download later feature.";
+const char kDownloadLaterDebugOnWifiName[] =
+ "Show download later dialog on WIFI.";
+const char kDownloadLaterDebugOnWifiNameDescription[] =
+ "Show download later dialog on WIFI.";
+
const char kEnableLayoutNGName[] = "Enable LayoutNG";
const char kEnableLayoutNGDescription[] =
"Enable Blink's next generation layout engine.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index c3450c8..4009af84 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -512,6 +512,9 @@
extern const char kDownloadLaterName[];
extern const char kDownloadLaterDescription[];
+extern const char kDownloadLaterDebugOnWifiName[];
+extern const char kDownloadLaterDebugOnWifiNameDescription[];
+
extern const char kDuetTabStripIntegrationAndroidName[];
extern const char kDuetTabStripIntegrationAndroidDescription[];
diff --git a/components/download/public/common/download_features.cc b/components/download/public/common/download_features.cc
index 0a285685..41ec09e2 100644
--- a/components/download/public/common/download_features.cc
+++ b/components/download/public/common/download_features.cc
@@ -66,4 +66,10 @@
} // namespace features
+namespace switches {
+
+const char kDownloadLaterDebugOnWifi[] = "download-later-debug-on-wifi";
+
+} // namespace switches
+
} // namespace download
diff --git a/components/download/public/common/download_features.h b/components/download/public/common/download_features.h
index 82a9895c..55a1097 100644
--- a/components/download/public/common/download_features.h
+++ b/components/download/public/common/download_features.h
@@ -62,6 +62,14 @@
} // namespace features
+namespace switches {
+
+// If set, show the download later dialog without the requirement of being on
+// cellular network.
+COMPONENTS_DOWNLOAD_EXPORT extern const char kDownloadLaterDebugOnWifi[];
+
+} // namespace switches
+
} // namespace download
#endif // COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_FEATURES_H_
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 59dc4ee..26946ac 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -41387,6 +41387,7 @@
<int value="-153299083" label="NewProfilePicker:disabled"/>
<int value="-152677714" label="AsmJsToWebAssembly:enabled"/>
<int value="-152632720" label="RuntimeHostPermissions:enabled"/>
+ <int value="-152439608" label="download-later-debug-on-wifi"/>
<int value="-147283486" label="enable-network-portal-notification"/>
<int value="-146552997" label="enable-affiliation-based-matching"/>
<int value="-144134779" label="AndroidPayIntegrationV2:disabled"/>