power: Avoid suspending immediately when retry is scheduled.

After a failed suspend attempt, the Suspender class waits
ten seconds before retrying. If it receives another suspend
request while waiting, it suspends immediately.

The StateController class sends a suspend request
immediately if it sees the system resume while the lid is
still closed.

Combined, this means that the system will repeatedly retry
suspending without any delay if suspending is failing while
the lid is closed. To avoid this, make Suspender ignore
suspend requests while a retry is already scheduled.

BUG=chromium:384610
TEST=updated tests for new behavior

Change-Id: I17711a74e2e3d8b830dffdafb4bd74a137503fcf
Reviewed-on: https://chromium-review.googlesource.com/203773
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
3 files changed