Commit 16fd4c04 authored by John Lee's avatar John Lee Committed by Commit Bot

WebUI Tab Strip: Fix flaky tests

Previously, there was a race condition between when the
IntersectionObserver's callback would get fired for the first time
each TabElement was added into the view, and when the callback
would be expected to have been called for an individual test's
setup.

Ran 100 times with no failures.

Fixed: 1022008
Change-Id: I5e418cb8fc691fd4ecd32c3d88a9805f1bdc2f0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1902070Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: John Lee <johntlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713314}
parent 71dfd2d3
......@@ -419,6 +419,7 @@ suite('TabList', () => {
// Wait for slideIn animations to complete updating widths and reset
// resolvers to track new calls.
await tabList.animationPromises;
await testTabsApiProxy.whenCalled('setThumbnailTracked');
testTabsApiProxy.reset();
const tabElements = getUnpinnedTabs();
......@@ -460,6 +461,7 @@ suite('TabList', () => {
test('tracks and untracks thumbnails based on pinned state', async () => {
await tabList.animationPromises;
await testTabsApiProxy.whenCalled('setThumbnailTracked');
testTabsApiProxy.reset();
// Update width such that at all tabs can fit and do not fire the
......@@ -480,18 +482,13 @@ suite('TabList', () => {
[tabId, thumbnailTracked] =
await testTabsApiProxy.whenCalled('setThumbnailTracked');
// TODO(johntlee): Remove debug logs if tests are no longer flaky.
console.log(`Window width is ${window.innerWidth}px`);
for (const tabElement of getUnpinnedTabs()) {
console.log(`Tab ${tabElement.tab.id} is at ${tabElement.offsetLeft}`);
}
assertEquals(tabId, tabs[2].id);
assertEquals(thumbnailTracked, true);
});
test('should update thumbnail track status on visibilitychange', async () => {
await tabList.animationPromises;
await testTabsApiProxy.whenCalled('setThumbnailTracked');
testTabsApiProxy.reset();
testTabStripEmbedderProxy.setVisible(false);
......
......@@ -36,8 +36,7 @@ var TabStripTabListTest = class extends TabStripBrowserTest {
}
};
// Flaky on debug builds - crbug.com/1022008
TEST_F('TabStripTabListTest', 'DISABLED_All', function() {
TEST_F('TabStripTabListTest', 'All', function() {
mocha.run();
});
......
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