power_BacklightServer: Exit with error if power conditions not met

Raise TestError instead of TestFail if power daemons are not running or
if AC is not plugged in.

Also, restore als settings only if they had been successfully modified
before running the test.  This avoids the case where the test pre-checks
fail, and the als is never disabled.

BUG=chromium-os:25867
TEST=Run power_BacklightServer with AC unplugged.  Should print error
message and exit without raising an error.

Change-Id: I281fbed07820a7c18203bb100399fb4f764e745f
Signed-off-by: Simon Que <sque@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31623
Reviewed-by: Nirnimesh <nirnimesh@chromium.org>
1 file changed