Commit 0689566b authored by Rachel Sugrono's avatar Rachel Sugrono Committed by Commit Bot

[QuickView] Add tab-index focus test for text files

Add a test that tab-index key focus works correctly (the tab-indexable
elements are cycled through in order) when Quick View is displaying a
text file in its content area.

Tab past the content panel to skip over checking the focus on the content
webview.

Bug: 907380
Change-Id: Ia800bf7a04633376d7c355e0947d2fcaa9bf72f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2000281
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#731868}
parent 14446a0b
...@@ -465,6 +465,7 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( ...@@ -465,6 +465,7 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("openQuickViewRemovablePartitions"), TestCase("openQuickViewRemovablePartitions"),
TestCase("openQuickViewMtp"), TestCase("openQuickViewMtp"),
TestCase("openQuickViewTabIndexImage"), TestCase("openQuickViewTabIndexImage"),
TestCase("openQuickViewTabIndexText"),
TestCase("pressEnterOnInfoBoxToOpenClose"), TestCase("pressEnterOnInfoBoxToOpenClose"),
TestCase("closeQuickView"), TestCase("closeQuickView"),
TestCase("cantOpenQuickViewWithMultipleFiles"), TestCase("cantOpenQuickViewWithMultipleFiles"),
......
...@@ -1338,4 +1338,41 @@ ...@@ -1338,4 +1338,41 @@
await remoteCall.waitForElement(appId, query.query); await remoteCall.waitForElement(appId, query.query);
} }
}; };
/**
* Tests the tab-index focus order when sending tab keys when a text file is
* shown in Quick View.
*/
testcase.openQuickViewTabIndexText = async () => {
// Prepare a list of tab-index focus queries.
const tabQueries = [
{'query': ['#quick-view', '[aria-label="Back"]:focus']},
{'query': ['#quick-view', '[aria-label="Open"]:focus']},
{'query': ['#quick-view', '[aria-label="File info"]:focus']},
{'query': ['#quick-view']}, // Tab past the content panel.
{'query': ['#quick-view', '[aria-label="Back"]:focus']},
];
// Open Files app on Downloads containing ENTRIES.tallText.
const appId = await setupAndWaitUntilReady(
RootPath.DOWNLOADS, [ENTRIES.tallText], []);
// Open the file in Quick View.
await openQuickView(appId, ENTRIES.tallText.nameText);
for (const query of tabQueries) {
// Make the browser dispatch a tab key event to FilesApp.
const result = await sendTestMessage(
{name: 'dispatchTabKey', shift: query.shift || false});
chrome.test.assertEq(
result, 'tabKeyDispatched', 'Tab key dispatch failure');
// Note: Allow 500ms between key events to filter out the focus
// traversal problems noted in crbug.com/907380#c10.
await wait(500);
// Check: the queried element should gain the focus.
await remoteCall.waitForElement(appId, query.query);
}
};
})(); })();
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