Commit 8f088c62 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[quickview] Add openQuickViewTabIndexHtml test

Duplicate the openQuickViewTabIndexText test but here use an HTML file
as the preview file. This to document a difference between the preview
HTML and TEXT content renderers. The HTML renderer content is not part
of the tabindex order, while the TEXT renderer content *is*. Add a new
test to document the HTML renderer tabindex behavior.

Test: browser_tests --gtest_filter="*openQuickViewTabIndexHtml"
No-try: true
Bug: 1064855
Change-Id: Ieae14b0468c1142feeb23a240fb8f73c119bef4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2425605
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809705}
parent 8514a398
...@@ -521,6 +521,7 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( ...@@ -521,6 +521,7 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("openQuickViewMtp"), TestCase("openQuickViewMtp"),
TestCase("openQuickViewTabIndexImage"), TestCase("openQuickViewTabIndexImage"),
TestCase("openQuickViewTabIndexText"), TestCase("openQuickViewTabIndexText"),
TestCase("openQuickViewTabIndexHtml"),
TestCase("openQuickViewTabIndexAudio"), TestCase("openQuickViewTabIndexAudio"),
TestCase("openQuickViewTabIndexVideo"), TestCase("openQuickViewTabIndexVideo"),
TestCase("openQuickViewTabIndexDeleteDialog"), TestCase("openQuickViewTabIndexDeleteDialog"),
......
...@@ -2361,6 +2361,43 @@ ...@@ -2361,6 +2361,43 @@
} }
}; };
/**
* Tests the tab-index focus order when sending tab keys when an HTML file is
* shown in Quick View.
*/
testcase.openQuickViewTabIndexHtml = 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="Delete"]:focus']},
{'query': ['#quick-view', '[aria-label="File info"]:focus']},
{'query': ['#quick-view', '[aria-label="Back"]:focus']},
];
// Open Files app on Downloads containing ENTRIES.tallHtml.
const appId = await setupAndWaitUntilReady(
RootPath.DOWNLOADS, [ENTRIES.tallHtml], []);
// Open the file in Quick View.
await openQuickView(appId, ENTRIES.tallHtml.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);
}
};
/** /**
* Tests the tab-index focus order when sending tab keys when an audio file is * Tests the tab-index focus order when sending tab keys when an audio file is
* shown in Quick View. * shown in Quick View.
......
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