Commit 6c0aa1d0 authored by Anand K. Mistry's avatar Anand K. Mistry Committed by Commit Bot

[directorytree] Avoid accessing smbfs shares until the VolumeItem is activated

This follows the behaviour of SMB shares mounted using the FSP-based
smbprovider.

Bug: 1054704
Change-Id: I7f1b6419c4de8e327c8fbeba0f753d3df187d7a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2100553Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Anand Mistry <amistry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751201}
parent 57098dce
......@@ -1145,7 +1145,9 @@ class VolumeItem extends DirectoryItem {
// Populate children of this volume using resolved display root. For SMB
// shares, avoid prefetching sub directories to delay authentication.
if (modelItem.volumeInfo_.providerId !== '@smb') {
if (modelItem.volumeInfo_.providerId !== '@smb' &&
modelItem.volumeInfo_.volumeType !==
VolumeManagerCommon.VolumeType.SMB) {
this.volumeInfo_.resolveDisplayRoot((displayRoot) => {
this.resolved_ = true;
this.updateSubDirectories(false /* recursive */);
......
......@@ -902,6 +902,15 @@ function testAddProviders(callback) {
fakeFileSystemURLEntries['filesystem:smb/child'] =
MockDirectoryEntry.create(smbProvider, '/smb_child');
// Add a volume representing an smbfs share to the mock filesystem.
volumeManager.createVolumeInfo(
VolumeManagerCommon.VolumeType.SMB, 'smbfs', 'SMBFS_LABEL');
// Add a sub directory to the Smb provider.
const smbfs = assert(volumeManager.volumeInfoList.item(4).fileSystem);
fakeFileSystemURLEntries['filesystem:smbfs/child'] =
MockDirectoryEntry.create(smbfs, '/smbfs_child');
// Populate the directory tree with the mock filesystem.
let directoryTree = createElements();
const metadataModel = createMockMetadataModel();
......@@ -916,14 +925,16 @@ function testAddProviders(callback) {
directoryTree.redraw(true);
// At top level, Drive and downloads should be listed.
assertEquals(4, directoryTree.items.length);
assertEquals(5, directoryTree.items.length);
assertEquals(str('DRIVE_DIRECTORY_LABEL'), directoryTree.items[0].label);
assertEquals(str('DOWNLOADS_DIRECTORY_LABEL'), directoryTree.items[1].label);
assertEquals('NOT_SMB_LABEL', directoryTree.items[2].label);
assertEquals('SMB_LABEL', directoryTree.items[3].label);
assertEquals('SMBFS_LABEL', directoryTree.items[4].label);
const providerItem = directoryTree.items[2];
const smbItem = directoryTree.items[3];
const smbfsItem = directoryTree.items[4];
reportPromise(
waitUntil(() => {
// Under providerItem there should be 1 entry, 'child'. Ensure there are
......@@ -932,6 +943,7 @@ function testAddProviders(callback) {
}).then(() => {
assertEquals('child', providerItem.items[0].label);
assertEquals(0, smbItem.items.length);
assertEquals(0, smbfsItem.items.length);
}),
callback);
}
......
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