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:

committed by
Chromium LUCI CQ

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