Commit 9f12070d authored by Alex Danilo's avatar Alex Danilo Committed by Commit Bot

Reomve unwanted delete button in Recent folder

Change https://chromium-review.googlesource.com/c/chromium/src/+/1457884
removed the read only check on the current directory model which had
the side effect of making the 'delete' button visible when choosing
the 'Recent' folder in FilesApp.

This CL fixes the regression by reinstating that check.
Bug: 935345
Tests: Added testing for delete button in existing integration test.

Change-Id: I8e89afd8918778057526671e42d8d776051bc6b9
Reviewed-on: https://chromium-review.googlesource.com/c/1491736Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Alex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636305}
parent 5eff782d
...@@ -147,7 +147,8 @@ ToolbarController.prototype.onSelectionChanged_ = function() { ...@@ -147,7 +147,8 @@ ToolbarController.prototype.onSelectionChanged_ = function() {
// Update visibility of the delete button. // Update visibility of the delete button.
this.deleteButton_.hidden = this.deleteButton_.hidden =
(selection.totalCount === 0 || selection.hasReadOnlyEntry() || (selection.totalCount === 0 || this.directoryModel_.isReadOnly() ||
selection.hasReadOnlyEntry() ||
(util.isMyFilesVolumeEnabled() && (util.isMyFilesVolumeEnabled() &&
this.directoryModel_.getCurrentRootType() == this.directoryModel_.getCurrentRootType() ==
VolumeManagerCommon.RootType.DOWNLOADS && VolumeManagerCommon.RootType.DOWNLOADS &&
......
...@@ -12,6 +12,31 @@ async function verifyRecents(appId, expectedRecents = RECENT_ENTRY_SET) { ...@@ -12,6 +12,31 @@ async function verifyRecents(appId, expectedRecents = RECENT_ENTRY_SET) {
// future. // future.
const files = TestEntryInfo.getExpectedRows(expectedRecents); const files = TestEntryInfo.getExpectedRows(expectedRecents);
await remoteCall.waitForFiles(appId, files); await remoteCall.waitForFiles(appId, files);
// Select all the files and check that the delete button isn't visible.
// First, wait for the gear menu button to appear.
await remoteCall.waitForElement(appId, '#gear-button');
// Click the gear menu button.
chrome.test.assertTrue(await remoteCall.callRemoteTestUtil(
'fakeMouseClick', appId, ['#gear-button']));
// Check: #select-all command is shown, and enabled (there are files).
await remoteCall.waitForElement(
appId,
'#gear-menu:not([hidden]) cr-menu-item' +
'[command=\'#select-all\']' +
':not([disabled]):not([hidden])');
// Click on the #gear-menu-select-all item.
chrome.test.assertTrue(await remoteCall.callRemoteTestUtil(
'fakeMouseClick', appId, ['#gear-menu-select-all']));
// Check: the file-list should be selected.
await remoteCall.waitForElement(appId, '#file-list li[selected]');
// Test that the delete button isn't visible.
const deleteButton = await remoteCall.waitForElement(appId, '#delete-button');
chrome.test.assertTrue(deleteButton.hidden, 'delete button should be hidden');
} }
testcase.recentsDownloads = async function() { testcase.recentsDownloads = async function() {
......
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