autotest: Encapsulate dark_resume_utils, add DR counter
Currently, tests have no way of telling the difference between
full resumes and dark resumes, and dark resumes may be short enough
that wait_up isn't going to catch them. This adds a listener on the
DUT which counts DarkSuspendImminent DBus signals, which are sent
as soon as powerd notices we are in dark resume, and adds a function
which allows us to wait for some period of time and then ask the
listener how many signals it noticed.
dark_resume_utils now takes the form of a class instead of a bunch
of functions you call during intialization and teardown because there
is now state which needs to persist across those parts of the test.
It also exposes a better way to suspend for dark resume tests because
we can't rely on the RTC timer waking us up (since that will cause a
dark resume and resuspend), and makes sure that this doesn't put us
to sleep forever.
BUG=chromium:466731
TEST=convert WakeOnDisconnect/WoWLAN to use this, make sure
tests pass
Change-Id: Icb0d7b555685dad7673cbc81840e40eccd282f38
Reviewed-on: https://chromium-review.googlesource.com/260038
Trybot-Ready: Samuel Tan <samueltan@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Samuel Tan <samueltan@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
6 files changed