Fix flaky UkmBrowserTest.EvictObsoleteSources
The browser test UkmBrowserTest.EvictObsoleteSources checks that UKM sources id are properly marked as obsolete and deleted by navigating to and leaving a few example sites, and it began to fail recently due to external change in one of the sites used in the test case. This is because source ids in the tests were obtained from web contents, which could differ from the navigation source id, for example if the site executes a same-document navigation (e.g. history.pushState/replaceState) in the case of https://www.google.com used in the test (https://screenshot.googleplex.com/xofrBc6JHB8.png). This CL updates the test to get the source id associated to the last committed navigation from the navigation handle instead, which is consistent with the id being marked by SourceUrlRecorderWebContentsObserver::DidFinishNavigation that we aim to test. https://cs.chromium.org/chromium/src/components/ukm/content/source_url_recorder.cc?type=cs&q=+MarkSourceForDeletion&g=0&l=237 This also changes to use an embedded test server to not depend on external content anymore. Bug: 1004296 Change-Id: I08d7f225588598655dd946f8661d32a8dbdf53ac Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1929018Reviewed-by:Alexei Svitkine <asvitkine@chromium.org> Commit-Queue: Yue Ru Sun <yrsun@chromium.org> Cr-Commit-Position: refs/heads/master@{#718304}
Showing
Please register or sign in to comment