Commit fd16dd07 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Reland "Files app: Change opening a folder navigates to the folder"

This is a reland of fc33ef5c

Change getBreadcrumbPath() to check if '#location-breadcrumbs' wasn't
found to fix the issue when running on linux-chromeos-dbg.

Original change's description:
> Files app: Change opening a folder navigates to the folder
>
> Change Files app to navigate to the directory when a "selectionURL"
> provided in the launch params. Before this CL Files app would only show
> the directory selected.
>
> This change is to support the workflow from Issue:1090211. From ARC++
> the intent to "ACTION_VIEW_DOWNLOADS" will open the Files app in the
> Downloads folder.
>
> Bug: 1090211
> Change-Id: Ic6b9d290936f4a25576f3bfd5a799c37f6fa2195
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2379345
> Reviewed-by: Alex Danilo <adanilo@chromium.org>
> Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#804071}

Bug: 1090211, 1125408
Change-Id: Ib1efce5415589842f671420e5adfb1bfd3ea5d9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2393412
Auto-Submit: Luciano Pacheco <lucmult@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804657}
parent 4074761b
...@@ -485,6 +485,10 @@ test.util.sync.unload = contentWindow => { ...@@ -485,6 +485,10 @@ test.util.sync.unload = contentWindow => {
test.util.sync.getBreadcrumbPath = contentWindow => { test.util.sync.getBreadcrumbPath = contentWindow => {
const breadcrumb = const breadcrumb =
contentWindow.document.querySelector('#location-breadcrumbs'); contentWindow.document.querySelector('#location-breadcrumbs');
if (!breadcrumb) {
return '';
}
let path = ''; let path = '';
if (util.isFilesNg()) { if (util.isFilesNg()) {
......
...@@ -1252,10 +1252,8 @@ class FileManager extends cr.EventTarget { ...@@ -1252,10 +1252,8 @@ class FileManager extends cr.EventTarget {
nextCurrentDirEntry = inEntry; nextCurrentDirEntry = inEntry;
} }
// If this dialog attempts to open file(s) and the selection is a // If the |selectionURL| is a directory make it the current directory.
// directory, the selection should be the current directory. if (inEntry.isDirectory) {
if (DialogType.isOpenFileDialog(this.dialogType) &&
inEntry.isDirectory) {
nextCurrentDirEntry = inEntry; nextCurrentDirEntry = inEntry;
} }
......
...@@ -51,9 +51,9 @@ testcase.fileDisplayLaunchOnLocalFolder = async () => { ...@@ -51,9 +51,9 @@ testcase.fileDisplayLaunchOnLocalFolder = async () => {
// Wait for app window to open. // Wait for app window to open.
const appId = await remoteCall.waitForWindow('files#'); const appId = await remoteCall.waitForWindow('files#');
// Check: the Downloads/photos folder should be selected. // Check: The current directory is MyFiles/Downloads/photos.
await remoteCall.waitForElement( await remoteCall.waitUntilCurrentDirectoryIsChanged(
appId, '#file-list [file-name="photos"][selected]'); appId, '/My files/Downloads/photos');
// The API used to launch the Files app does not set the IN_TEST flag to true: // The API used to launch the Files app does not set the IN_TEST flag to true:
// error when attempting to retrieve Web Store access token. // error when attempting to retrieve Web Store access token.
......
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