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
17import acts.test_utils.power.PowerCoexBaseTest as PCoBT
18from acts.test_decorators import test_tracker_info
19
20
21class PowerCoexbaselineTest(PCoBT.PowerCoexBaseTest):
22    def coex_baseline_test_func(self):
23        """Base function to do coex baseline tests.
24
25        Steps:
26        1. Set the phone into desired state (WiFi, BT/BLE, cellular)
27        2. Measures the power consumption
28        3. Asserts pass/fail criteria based on measured power
29        """
30        attrs = [
31            'screen_status', 'wifi_status', 'wifi_band', 'bt_status',
32            'ble_status', 'cellular_status', 'cellular_band'
33        ]
34        indices = [2, 4, 6, 8, 10, 12, 14]
35        self.decode_test_configs(attrs, indices)
36        self.coex_test_phone_setup(
37            self.test_configs.screen_status, self.test_configs.wifi_status,
38            self.test_configs.wifi_band, self.test_configs.bt_status,
39            self.test_configs.ble_status, self.test_configs.cellular_status,
40            self.test_configs.cellular_band)
41        self.measure_power_and_validate()
42
43    @test_tracker_info(uuid='f3fc6667-73d8-4fb5-bdf3-0253e52043b1')
44    def test_screen_OFF_WiFi_ON_band_None_bt_ON_ble_ON_cellular_OFF_band_None(
45            self):
46        self.coex_baseline_test_func()
47
48    @test_tracker_info(uuid='1bec36d1-f7b2-4a4b-9f5d-dfb5ed985649')
49    def test_screen_OFF_WiFi_Connected_band_2g_bt_ON_ble_ON_cellular_OFF_band_None(
50            self):
51        self.coex_baseline_test_func()
52
53    @test_tracker_info(uuid='88170cad-8336-4dff-8e53-3cc693d01b72')
54    def test_screen_OFF_WiFi_Connected_band_5g_bt_ON_ble_ON_cellular_OFF_band_None(
55            self):
56        self.coex_baseline_test_func()
57
58    @test_tracker_info(uuid='b82e59a9-9b27-4ba2-88f6-48d7917066f4')
59    def test_screen_OFF_WiFi_OFF_band_None_bt_ON_ble_ON_cellular_ON_band_Verizon(
60            self):
61        self.coex_baseline_test_func()
62
63    @test_tracker_info(uuid='6409a02e-d63a-4c46-a210-1d5f1b006556')
64    def test_screen_OFF_WiFi_Connected_band_5g_bt_OFF_ble_OFF_cellular_ON_band_Verizon(
65            self):
66        self.coex_baseline_test_func()
67
68    @test_tracker_info(uuid='6f22792f-b304-4804-853d-e41484d442ab')
69    def test_screen_OFF_WiFi_Connected_band_2g_bt_OFF_ble_OFF_cellular_ON_band_Verizon(
70            self):
71        self.coex_baseline_test_func()
72
73    @test_tracker_info(uuid='11bb1683-4544-46b4-ad4a-875e31323729')
74    def test_screen_OFF_WiFi_Connected_band_5g_bt_ON_ble_ON_cellular_ON_band_Verizon(
75            self):
76        self.coex_baseline_test_func()
77