Commit 3936e7e2 authored by Josh Simmons's avatar Josh Simmons Committed by Commit Bot

Show space available in 3-dot context menu for SMB shares

SMB shares are now implemented by a FUSE filesystem that natively
supports statvfs(). Allow the available space on an SMB share to be
displayed in Files.app's gear menu.

Test: browser_tests --gtest_filter="*showAvailableStorage*"
Bug: 1082035
Change-Id: I144f2f7ff0cb3106ec33d3a5e9bff6a87d367c6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2423125
Commit-Queue: Josh Simmons <simmonsjosh@google.com>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809545}
parent 54ad18ef
...@@ -887,7 +887,10 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( ...@@ -887,7 +887,10 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("hideCurrentDirectoryByTogglingHiddenAndroidFolders"), TestCase("hideCurrentDirectoryByTogglingHiddenAndroidFolders"),
TestCase("newFolderInDownloads"), TestCase("newFolderInDownloads"),
TestCase("showSendFeedbackAction"), TestCase("showSendFeedbackAction"),
TestCase("enableDisableStorageSettingsLink"))); TestCase("enableDisableStorageSettingsLink"),
TestCase("showAvailableStorageMyFiles"),
TestCase("showAvailableStorageDrive"),
TestCase("showAvailableStorageSmbfs").EnableSmbfs()));
WRAPPED_INSTANTIATE_TEST_SUITE_P( WRAPPED_INSTANTIATE_TEST_SUITE_P(
FilesTooltip, /* files_tooltip.js */ FilesTooltip, /* files_tooltip.js */
......
...@@ -132,8 +132,7 @@ class GearMenuController { ...@@ -132,8 +132,7 @@ class GearMenuController {
currentVolumeInfo.volumeType == currentVolumeInfo.volumeType ==
VolumeManagerCommon.VolumeType.DOCUMENTS_PROVIDER || VolumeManagerCommon.VolumeType.DOCUMENTS_PROVIDER ||
currentVolumeInfo.volumeType == currentVolumeInfo.volumeType ==
VolumeManagerCommon.VolumeType.ARCHIVE || VolumeManagerCommon.VolumeType.ARCHIVE) {
currentVolumeInfo.volumeType == VolumeManagerCommon.VolumeType.SMB) {
this.gearMenu_.setSpaceInfo(null, false); this.gearMenu_.setSpaceInfo(null, false);
return; return;
} }
......
...@@ -478,3 +478,86 @@ testcase.enableDisableStorageSettingsLink = async () => { ...@@ -478,3 +478,86 @@ testcase.enableDisableStorageSettingsLink = async () => {
// Check: volume space info should be disabled for external volume. // Check: volume space info should be disabled for external volume.
await remoteCall.waitForElement(appId, '#volume-space-info[disabled]'); await remoteCall.waitForElement(appId, '#volume-space-info[disabled]');
}; };
/**
* Tests that the "xGB available" message appears in the gear menu for
* the "My Files" volume.
*/
testcase.showAvailableStorageMyFiles = async () => {
// Open Files app on Downloads containing ENTRIES.photos.
const appId =
await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.photos], []);
// Wait for the gear menu button to appear and click it.
await remoteCall.waitAndClickElement(appId, '#gear-button');
// Wait for the gear menu to appear.
await remoteCall.waitForElement(appId, '#gear-menu:not([hidden])');
// Check #volume-storage is shown and it's enabled.
await remoteCall.waitForElement(
appId,
'#gear-menu:not([hidden]) cr-menu-item' +
'[command=\'#volume-storage\']' +
':not([disabled]):not([hidden])');
};
/**
* Tests that the "xGB available message appears in the gear menu for
* the "Google Drive" volume.
*/
testcase.showAvailableStorageDrive = async () => {
// Open Files app on Drive containing ENTRIES.hello.
const appId =
await setupAndWaitUntilReady(RootPath.DRIVE, [], [ENTRIES.hello]);
// Wait for the gear menu button to appear and click it.
await remoteCall.waitAndClickElement(appId, '#gear-button');
// Wait for the gear menu to appear.
await remoteCall.waitForElement(appId, '#gear-menu:not([hidden])');
// Check #volume-storage is shown and disabled (can't manage Drive
// storage).
await remoteCall.waitForElement(
appId,
'#gear-menu:not([hidden]) cr-menu-item' +
'[command=\'#volume-storage\']' +
':not([hidden])');
};
/**
* Tests that the "xGB available message appears in the gear menu for
* an SMB volume.
*/
testcase.showAvailableStorageSmbfs = async () => {
// Populate Smbfs with some files.
await addEntries(['smbfs'], BASIC_LOCAL_ENTRY_SET);
// Mount Smbfs volume.
await sendTestMessage({name: 'mountSmbfs'});
// Open Files app on Downloads containing ENTRIES.photos.
const appId =
await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.photos], []);
await navigateWithDirectoryTree(appId, '/SMB Share');
// Wait for the volume's file list to appear.
const files = TestEntryInfo.getExpectedRows(BASIC_LOCAL_ENTRY_SET);
await remoteCall.waitForFiles(appId, files, {ignoreLastModifiedTime: true});
// Wait for the gear menu button to appear and click it.
await remoteCall.waitAndClickElement(appId, '#gear-button');
// Wait for the gear menu to appear.
await remoteCall.waitForElement(appId, '#gear-menu:not([hidden])');
// Check #volume-storage is shown and disabled (can't manage SMB
// storage).
await remoteCall.waitForElement(
appId,
'#gear-menu:not([hidden]) cr-menu-item' +
'[command=\'#volume-storage\']' +
':not([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