Add view waiting function as test util

The added function |waitForView| repeatedly checks all views in a group
until either a view was found that matches the given matcher.
If this doesn't happen within a certain time or multiple views are
matched, it fails the test.

This simplifies UI tests by:
 - reducing flakiness, e.g. introduced due to animations
 - removing the need for sleeps or other timers.
 - reducing code duplication due to providing a central implementation

Upcoming CLs that would benefit greatly from this:
https://crrev.com/c/951588 and https://crrev.com/c/951764

Change-Id: Ibb6a0dcd2eb688467c4af1eaa82341f84e7e8bc6
Reviewed-on: https://chromium-review.googlesource.com/951688
Commit-Queue: Friedrich Horschig <[email protected]>
Reviewed-by: Bernhard Bauer <[email protected]>
Cr-Commit-Position: refs/heads/master@{#542172}
3 files changed