# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from autotest_lib.server import utils

AUTHOR = "ChromeOS Team"
NAME = "power_BrightnessResetAfterReboot"
PURPOSE = "default brightness test."
CRITERIA = "This test will fail if unable to set the default brightness after reboot."
TIME = "SHORT"
TEST_CATEGORY = "Functional"
TEST_CLASS = "power"
TEST_TYPE = "server"
ATTRIBUTES = "suite:bvt-perbuild, suite:partners"
REQUIRE_SSP = False
PY_VERSION = 3

DOC = """
This test:
1. Checks that ambient light sensor exists if specified in powerd prefs.
2. Checks that the default brightness after initial boot is reasonable.
3. Changes the brightness level to min (0%) and max (100%).
4. Checks that the brightness level resets after rebooting the device.

The test fails if:
-Ambient light sensor does not exist even though specified in powerd prefs.
-Initial brightness is not reasonable.
-Device not able to change brightness to min and max levels.
-Device not able to set the brightness level to default after reboot.

Note: for devices with ambient light sensor, test will allow for a small change
in internal display brightness; test will fail if internal display brightness
changes drastically.

Example usage:
test_that -b <board> <host> power_BrightnessResetAfterReboot
"""

def run(machine):
    host = hosts.create_host(machine)
    job.run_test("power_BrightnessResetAfterReboot", host=host,
                 disable_sysinfo=True, client_autotest="desktopui_SimpleLogin")

parallel_simple(run, machines)
