Commit 9ecc4552 authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Files app: propagate IN_TEST to dialogs too

Files app dialogs (file picker / save as) aren't opened by background
page, thus they didn't get the IN_TEST state forwarded to them. This CL
changes Files app background to attach IN_TEST to the dialog during
dialog registration. This happens before the UI initialization.

This fixes the issue where test functions can't use test-only attributes
to select elements in the page, for example when trying to use
|navigateWithDirectoryTree| which relies on |full-path-for-testing|
attribute.

Bug: 903669
Change-Id: I8ad19965cddbc6bd6779c9c6f2710872b830754c
Reviewed-on: https://chromium-review.googlesource.com/c/1334992Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Luciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607935}
parent 478dff1d
......@@ -319,6 +319,8 @@ var nextFileManagerDialogID = 0;
function registerDialog(dialogWindow) {
var id = DIALOG_ID_PREFIX + (nextFileManagerDialogID++);
window.background.dialogs[id] = dialogWindow;
if (window.IN_TEST)
dialogWindow.IN_TEST = true;
dialogWindow.addEventListener('pagehide', function() {
delete window.background.dialogs[id];
});
......
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