1#!/usr/bin/env python3.4
2#
3#   Copyright 2018 - The Android Open Source Project
4#
5#   Licensed under the Apache License, Version 2.0 (the 'License');
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an 'AS IS' BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16
17from acts.test_utils.power import PowerWiFiBaseTest as PWBT
18from acts.test_utils.wifi import wifi_test_utils as wutils
19from acts.test_decorators import test_tracker_info
20
21
22class PowerWiFibaselineTest(PWBT.PowerWiFiBaseTest):
23    """Power baseline tests for rockbottom state.
24    Rockbottom for wifi on/off, screen on/off, everything else turned off
25
26    """
27
28    def rockbottom_test_func(self):
29        """Test function for baseline rockbottom tests.
30
31        Decode the test config from the test name, set device to desired state.
32        Measure power and validate results.
33        """
34
35        attrs = ['screen_status', 'wifi_status']
36        indices = [3, 5]
37        self.decode_test_configs(attrs, indices)
38        if self.test_configs.wifi_status == 'ON':
39            wutils.wifi_toggle_state(self.dut, True)
40        if self.test_configs.screen_status == 'OFF':
41            self.dut.droid.goToSleepNow()
42            self.dut.log.info('Screen is OFF')
43        self.measure_power_and_validate()
44
45    # Test cases
46    @test_tracker_info(uuid='e7ab71f4-1e14-40d2-baec-cde19a3ac859')
47    def test_rockbottom_screen_OFF_wifi_OFF(self):
48
49        self.rockbottom_test_func()
50
51    @test_tracker_info(uuid='167c847d-448f-4c7c-900f-82c552d7d9bb')
52    def test_rockbottom_screen_OFF_wifi_ON(self):
53
54        self.rockbottom_test_func()
55
56    @test_tracker_info(uuid='2cd25820-8548-4e60-b0e3-63727b3c952c')
57    def test_rockbottom_screen_ON_wifi_OFF(self):
58
59        self.rockbottom_test_func()
60
61    @test_tracker_info(uuid='d7d90a1b-231a-47c7-8181-23814c8ff9b6')
62    def test_rockbottom_screen_ON_wifi_ON(self):
63
64        self.rockbottom_test_func()
65