Commit b594aff5 authored by John Lee's avatar John Lee Committed by Chromium LUCI CQ

WebUI Tab Strip: Fix possible flaky test for tracking pinned thumbnails

The previous failure of this test was caused by a tab that was not the
pinned tab being tested changing its tracked status. The only way a tab
element changes tracked status is because it intersects with the
threshold in the IntersectionObserver, changes pinned state, or is
added or removed from the DOM. This CL removes all tabs besides the tab
being tested so to hopefully make the test more reliable.

Fixed: 1156948
Change-Id: I36aae0861a8c4fb5f5520c229ee586c66c5727e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586092Reviewed-by: default avatardpapad <dpapad@chromium.org>
Commit-Queue: John Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836314}
parent 97503360
......@@ -775,10 +775,15 @@ suite('TabList', () => {
await testTabsApiProxy.whenCalled('setThumbnailTracked');
testTabsApiProxy.reset();
// Update width such that at all tabs can fit and do not fire the
// IntersectionObserver based on intersection alone.
tabList.style.setProperty(
'--tabstrip-tab-width', `${window.innerWidth / tabs.length}px`);
// Remove all other tabs to isolate the tab to test, and then wait for
// each tab to get untracked as it is removed from the DOM.
const tabElements = getUnpinnedTabs();
tabElements[0].remove();
await testTabsApiProxy.whenCalled('setThumbnailTracked');
testTabsApiProxy.reset();
tabElements[1].remove();
await testTabsApiProxy.whenCalled('setThumbnailTracked');
testTabsApiProxy.reset();
// Pinning the third tab should untrack thumbnails for the tab
pinTabAt(tabs[2], 0);
......
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