Add a universal wait-for-page-ready heuristic to the Autofill Captured Sites Interactive Uitest.

The Autofill Captured Sites Interactive Uitest test Chrome on real-world sites. A difficult challenge in working with real-world sites is determining when a page inside Chrome is ready for interaction.

The previous iteration of the test determines page ready by waiting for specific elements on a page to become visible. Using this heuristic, a test author must manually examine each page to identify the right set of elements.

This change adds a universal wait-for-page-ready heuristic. I constructed the new heuristic based on two observations:
1. If Chrome is not done loading a page, the Chrome tab should be busy and Chrome should continuously make paint updates to the page, as Chrome continue to make layout changes to the page.
2. If a page is doing background work and cannot respond to user input, the page will display some form of persistent animation, such as a progress bar or a spinner, to alert the user.

So the new heuristic determines page ready by waiting for the Chrome tab to finish loading and for Chrome to stop painting. The new heuristic monitors Chrome paints by instrumenting an event inside the content::RenderWidget::DidCommitAndDrawCompositorFrame() function.

As part of this change, I also made the following list of minor fixes:
1. Fixed an issue with the WPR certificate and key files the tests use.
2. Updated the JSON deserialization code inside the tests to remove
soon-to-be-deprecated functions.
3. Fixed a segmentation fault inside the GetCapturedSites() function.

Bug: 854828
Change-Id: Ic1d349fd80cc1f877a3a8a604ec4266452a8186d
Reviewed-by: Kinuko Yasuda <>
Reviewed-by: Sebastien Seguin-Gagnon <>
Commit-Queue: Yiming Zhou <>
Cr-Commit-Position: refs/heads/master@{#576938}
13 files changed