0

Files app: Avoid networking DCHECK by artificially waiting longer

These affected tests don't need the Files app fully loaded, however a
DCHECK in the networking layer crashes even though the test has passed.

Avoid the crash by waiting for Files app to fully load.

Bug: 1156958
Change-Id: Ia136989c492d0d16beec63b44ab73745f0980616
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586285
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835945}
This commit is contained in:
Luciano Pacheco
2020-12-11 01:36:40 +00:00
committed by Chromium LUCI CQ
parent f642d74936
commit 4681442576

@ -224,6 +224,19 @@ async function openFileDialogSendEscapeKey(volume, name) {
await openAndWaitForClosingDialog(type, volume, entrySet, closer));
}
/**
* Waits for the dialog window and waits it to fully load.
* @returns {!Promise<string>} dialog's id.
*/
async function waitForDialog() {
const dialog = await remoteCall.waitForWindow('dialog#');
// Wait for Files app to finish loading.
await remoteCall.waitFor('isFileManagerLoaded', dialog, true);
return dialog;
}
/**
* Tests for display:none status of feedback panels in Files app.
*
@ -232,7 +245,7 @@ async function openFileDialogSendEscapeKey(volume, name) {
async function checkFeedbackDisplayHidden(type) {
// Open dialog of the specified 'type'.
chrome.fileSystem.chooseEntry({type: type}, (entry) => {});
const appId = await remoteCall.waitForWindow('dialog#');
const appId = await waitForDialog();
// Wait to finish initial load.
await remoteCall.waitFor('isFileManagerLoaded', appId, true);
@ -262,7 +275,7 @@ testcase.openFileDialogDownloads = () => {
testcase.openFileDialogAriaMultipleSelect = async () => {
// Open File dialog.
chrome.fileSystem.chooseEntry({type: 'openFile'}, (entry) => {});
const appId = await remoteCall.waitForWindow('dialog#');
const appId = await waitForDialog();
// Wait to finish initial load.
await remoteCall.waitFor('isFileManagerLoaded', appId, true);
@ -282,7 +295,7 @@ testcase.openFileDialogAriaMultipleSelect = async () => {
testcase.saveFileDialogAriaSingleSelect = async () => {
// Open Save as dialog.
chrome.fileSystem.chooseEntry({type: 'saveFile'}, (entry) => {});
const appId = await remoteCall.waitForWindow('dialog#');
const appId = await waitForDialog();
// Wait to finish initial load.
await remoteCall.waitFor('isFileManagerLoaded', appId, true);
@ -310,7 +323,7 @@ testcase.saveFileDialogDownloads = () => {
testcase.saveFileDialogDownloadsNewFolderButton = async () => {
// Open Save as dialog.
chrome.fileSystem.chooseEntry({type: 'saveFile'}, (entry) => {});
const appId = await remoteCall.waitForWindow('dialog#');
const appId = await waitForDialog();
// Wait to finish initial load.
await remoteCall.waitFor('isFileManagerLoaded', appId, true);
@ -472,7 +485,7 @@ testcase.openFileDialogEscapeDrive = () => {
*/
testcase.openFileDialogUnload = async () => {
chrome.fileSystem.chooseEntry({type: 'openFile'}, (entry) => {});
const dialog = await remoteCall.waitForWindow('dialog#');
const dialog = await waitForDialog();
await unloadOpenFileDialog(dialog);
};
@ -487,7 +500,7 @@ testcase.openFileDialogDefaultFilter = async () => {
acceptsAllTypes: true,
};
chrome.fileSystem.chooseEntry(params, (entry) => {});
const dialog = await remoteCall.waitForWindow('dialog#');
const dialog = await waitForDialog();
// Check: 'JPEG image' should be selected.
const selectedFilter =
@ -506,7 +519,7 @@ testcase.saveFileDialogDefaultFilter = async () => {
acceptsAllTypes: true,
};
chrome.fileSystem.chooseEntry(params, (entry) => {});
const dialog = await remoteCall.waitForWindow('dialog#');
const dialog = await waitForDialog();
// Check: 'All files' should be selected.
const selectedFilter =
@ -515,7 +528,6 @@ testcase.saveFileDialogDefaultFilter = async () => {
chrome.test.assertEq('All files', selectedFilter.text);
};
/**
* Tests that the save file dialog's filetype filter can
* be navigated using the keyboard.
@ -527,7 +539,7 @@ testcase.saveFileDialogDefaultFilterKeyNavigation = async () => {
acceptsAllTypes: true,
};
chrome.fileSystem.chooseEntry(params, (entry) => {});
const dialog = await remoteCall.waitForWindow('dialog#');
const dialog = await waitForDialog();
// Check: 'All files' should be selected.
let selectedFilter =
@ -687,7 +699,7 @@ testcase.saveFileDialogSingleFilterNoAcceptAll = async () => {
acceptsAllTypes: false,
};
chrome.fileSystem.chooseEntry(params, (entry) => {});
const dialog = await remoteCall.waitForWindow('dialog#');
const dialog = await waitForDialog();
// Check: 'JPEG image' should be selected.
const selectedFilter =
@ -712,7 +724,7 @@ async function showSaveAndConfirmExpecting(extraParams, expectName) {
const result = new Promise(resolve => {
chrome.fileSystem.chooseEntry(Object.assign(params, extraParams), resolve);
});
const dialog = await remoteCall.waitForWindow('dialog#');
const dialog = await waitForDialog();
// Ensure the input field is ready.
await remoteCall.waitForElement(dialog, '#filename-input-textbox');
@ -773,7 +785,7 @@ testcase.openFileDialogFileListShowContextMenu = async () => {
// Open file picker dialog.
chrome.fileSystem.chooseEntry({type: 'openFile'}, (entry) => {});
const appId = await remoteCall.waitForWindow('dialog#');
const appId = await waitForDialog();
// Wait to finish initial load.
await remoteCall.waitFor('isFileManagerLoaded', appId, true);
@ -822,7 +834,7 @@ testcase.openFileDialogFileListShowContextMenu = async () => {
testcase.openFileDialogSelectAllDisabled = async () => {
// Open file picker dialog.
chrome.fileSystem.chooseEntry({type: 'openFile'}, (entry) => {});
const appId = await remoteCall.waitForWindow('dialog#');
const appId = await waitForDialog();
// Wait to finish initial load.
await remoteCall.waitFor('isFileManagerLoaded', appId, true);
@ -851,7 +863,7 @@ testcase.openMultiFileDialogSelectAllEnabled = async () => {
// Open file picker dialog with support for selecting multiple files.
chrome.fileSystem.chooseEntry(
{type: 'openFile', acceptsMultiple: true}, (entry) => {});
const appId = await remoteCall.waitForWindow('dialog#');
const appId = await waitForDialog();
// Wait to finish initial load.
await remoteCall.waitFor('isFileManagerLoaded', appId, true);