Commit 5c13e8c9 authored by David Black's avatar David Black Committed by Chromium LUCI CQ

Restrict volumes for showing holding space welcome banner.

Since holding space only supports a specific list of allowed volumes,
its welcome banner should only be shown on those volumes which the
feature supports.

Note that the holding space banner is also explicitly disallowed from
showing on Drive per UX request.

Bug: 1154347
Change-Id: I89e0c14ec9a6d1ec01700bd084e769d349243330
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2594314
Commit-Queue: David Black <dmblack@google.com>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837741}
parent 0ac34911
......@@ -664,6 +664,8 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("holdingSpaceWelcomeBannerWontShowAfterBeingDismissed")
.EnableHoldingSpace(true),
TestCase("holdingSpaceWelcomeBannerWontShowAfterReachingLimit")
.EnableHoldingSpace(true),
TestCase("holdingSpaceWelcomeBannerWontShowOnDrive")
.EnableHoldingSpace(true)));
WRAPPED_INSTANTIATE_TEST_SUITE_P(
......
......@@ -1782,6 +1782,20 @@ util.isHoldingSpaceEnabled = () => {
loadTimeData.getBoolean('HOLDING_SPACE_ENABLED');
};
/**
* Returns the volume types for which the holding space feature is allowed.
* @return {!Array<VolumeManagerCommon.VolumeType>}
*/
util.getHoldingSpaceAllowedVolumeTypes = () => {
return [
VolumeManagerCommon.VolumeType.ANDROID_FILES,
VolumeManagerCommon.VolumeType.CROSTINI,
VolumeManagerCommon.VolumeType.DRIVE,
VolumeManagerCommon.VolumeType.DOWNLOADS,
VolumeManagerCommon.VolumeType.MY_FILES,
];
};
util.isDriveDssPinEnabled = () => {
return loadTimeData.valueExists('DRIVE_DSS_PIN_ENABLED') &&
loadTimeData.getBoolean('DRIVE_DSS_PIN_ENABLED');
......
......@@ -1795,14 +1795,7 @@ CommandHandler.COMMANDS_['toggle-holding-space'] = new class extends Command {
return;
}
const allowedVolumeTypes = [
VolumeManagerCommon.VolumeType.MY_FILES,
VolumeManagerCommon.VolumeType.DOWNLOADS,
VolumeManagerCommon.VolumeType.DRIVE,
VolumeManagerCommon.VolumeType.CROSTINI,
VolumeManagerCommon.VolumeType.ANDROID_FILES,
];
const allowedVolumeTypes = util.getHoldingSpaceAllowedVolumeTypes();
const currentVolumeInfo = fileManager.directoryModel.getCurrentVolumeInfo();
if (!currentVolumeInfo ||
!allowedVolumeTypes.includes(currentVolumeInfo.volumeType)) {
......
......@@ -614,6 +614,18 @@ class Banners extends cr.EventTarget {
await this.ready_;
// The holding space feature is only allowed for specific volume types so
// its banner should only be shown for those volumes. Note that the holding
// space banner is explicitly disallowed from showing in `DRIVE` to prevent
// the possibility of it being shown alongside the Drive banner.
const allowedVolumeTypes = util.getHoldingSpaceAllowedVolumeTypes();
const currentVolumeInfo = this.directoryModel_.getCurrentVolumeInfo();
if (!currentVolumeInfo ||
!allowedVolumeTypes.includes(currentVolumeInfo.volumeType) ||
currentVolumeInfo.volumeType === VolumeManagerCommon.VolumeType.DRIVE) {
return;
}
// The holding space banner should not be shown after having been shown
// enough times to reach the defined limit. Note that if the user explicitly
// dismisses the banner the counter will be set to the limit to prevent any
......
......@@ -92,3 +92,14 @@ testcase.holdingSpaceWelcomeBannerWontShowAfterReachingLimit = async () => {
await remoteCall.waitForElement(
windowIds[2], '.holding-space-welcome[hidden]');
};
/**
* Tests that the holding space welcome banner will not show on Drive.
*/
testcase.holdingSpaceWelcomeBannerWontShowOnDrive = async () => {
// Open Files app on Drive.
const appId = await setupAndWaitUntilReady(RootPath.DRIVE);
// Check: the holding space welcome banner should be hidden.
await remoteCall.waitForElement(appId, '.holding-space-welcome[hidden]');
};
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