The upstream Chromium test BrowserContextDestructionVsCookieRemoval
flakes because document.cookie (set via JavaScript in the renderer)
uses a different Mojo pipe than GetAllCookies (queried from the browser
via CookieManager), with no ordering guarantee between the two.
Brave amplifies this from the upstream ~0.6 % rate because Ephemeral
Storage forces every cookie operation through IPC (disabling Chromium's
cookie cache optimization in CookieJar::IPCNeeded).
Add a chromium_src override for browsing_data_test_util.cc that calls
HasDataForType after SetDataForType. For cookies this forces a
round-trip through RestrictedCookieManager → CookieStore, serialising
with the prior SetCanonicalCookieAsync on the same CookieMonster task
runner and guaranteeing the cookie is committed before any subsequent
GetAllCookies query.
The BrowserContextDestructionVsCookieRemoval test has a separate issue:
BlockUntilCompletion() never returns after the incognito profile is
destroyed during data removal. CookieIncognitoDeletion also hangs in
incognito mode. Both remain disabled in the filter file.
Resolvesbrave/brave-browser#54537