Commit 72bc5708 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Change Drive root to be collapsed by default

Change tests that interact with Drive to expand it when needed.

Bug: 864291
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: Ibd013801c4bb5c1d1f3224707090eaf7ff0009a6
Reviewed-on: https://chromium-review.googlesource.com/1139848
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575574}
parent 8d415625
......@@ -258,19 +258,23 @@ test.util.sync.collapseSelectedFolderInTree = function(contentWindow) {
*
* @param {Window} contentWindow Window to be tested.
* @param {string} folderName Name of the folder to be selected.
* @return {boolean} True if file got selected, false otherwise.
* @return {boolean} True if Team Drive folder got selected, false otherwise.
*/
test.util.sync.selectTeamDrive = function(contentWindow, teamDriveName) {
// Select the 'Team Drives' root.
if (!test.util.sync.selectFolderInTree(contentWindow, 'Team Drives'))
// Select + expand Team Drives gran root.
const teamDrivesSelector = '#directory-tree .tree-item ' +
'[entry-label="Team Drives"]:not([hidden])';
if (!test.util.sync.fakeMouseClick(contentWindow, teamDrivesSelector))
return false;
// Expand the 'Team Drives' root.
if (!test.util.sync.expandSelectedFolderInTree(contentWindow))
return false;
// Select the team drive.
if (!test.util.sync.selectFolderInTree(contentWindow, teamDriveName))
// Select the team drive folder.
const teamDriveNameSelector = '#directory-tree .tree-item ' +
'[entry-label="' + teamDriveName + '"]:not([hidden])';
if (!test.util.sync.fakeMouseClick(contentWindow, teamDriveNameSelector))
return false;
return true;
......
......@@ -1049,7 +1049,6 @@ DriveVolumeItem.prototype.updateSubDirectories = function(recursive) {
this.add(item);
item.updateSubDirectories(false);
}
this.expanded = true;
};
/**
......
......@@ -78,6 +78,11 @@ function copyBetweenVolumes(targetFile, src, dst, opt_dstExpectedDialogText) {
entry.teamDriveName === ''))
.sort();
}
const myDriveContent = TestEntryInfo
.getExpectedRows(src.initialEntries.filter(
entry => entry.type !== EntryType.TEAM_DRIVE &&
entry.teamDriveName === ''))
.sort();
let dstContents;
if (dst.isTeamDrive) {
......@@ -100,9 +105,30 @@ function copyBetweenVolumes(targetFile, src, dst, opt_dstExpectedDialogText) {
setupAndWaitUntilReady(
null, RootPath.DOWNLOADS, this.next, localFiles, driveFiles);
},
// Select the source volume.
// Expand Drive root if either src or dst is within Drive.
function(results) {
appId = results.windowId;
if (src.isTeamDrive || dst.isTeamDrive) {
// Select + expand + wait for its content.
remoteCall
.callRemoteTestUtil('selectFolderInTree', appId, ['Google Drive'])
.then(result => {
chrome.test.assertTrue(result);
return remoteCall.callRemoteTestUtil(
'expandSelectedFolderInTree', appId, []);
})
.then(result => {
chrome.test.assertTrue(result);
return remoteCall.waitForFiles(appId, myDriveContent);
})
.then(this.next);
} else {
// If isn't drive source, just move on.
this.next();
}
},
// Select the source volume.
function() {
remoteCall.callRemoteTestUtil(
src.isTeamDrive ? 'selectTeamDrive' : 'selectVolume', appId,
[src.volumeName], this.next);
......
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