• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_decorators import test_tracker_info
18import acts.test_utils.power.PowerBTBaseTest as PBtBT
19
20
21class PowerBTbaselineTest(PBtBT.PowerBTBaseTest):
22    def bt_baseline_test_func(self):
23        """Base function for BT baseline measurement.
24
25        Steps:
26        1. Sets the phone in airplane mode, disables gestures and location
27        2. Turns ON/OFF BT, BLE and screen according to test conditions
28        3. Measures the power consumption
29        4. Asserts pass/fail criteria based on measured power
30        """
31
32        # Decode the test params from test name
33        attrs = ['screen_status', 'bt_status', 'ble_status', 'scan_status']
34        indices = [2, 4, 6, 7]
35        self.decode_test_configs(attrs, indices)
36        # Setup the phoen at desired state
37        self.phone_setup_for_BT(self.test_configs.bt_status,
38                                self.test_configs.ble_status,
39                                self.test_configs.screen_status)
40        if self.test_configs.scan_status == 'connectable':
41            self.dut.droid.bluetoothMakeConnectable()
42        elif self.test_configs.scan_status == 'discoverable':
43            self.dut.droid.bluetoothMakeDiscoverable(
44                self.mon_info.duration + self.mon_info.offset)
45        self.measure_power_and_validate()
46
47    # Test cases- Baseline
48    @test_tracker_info(uuid='3f8ac0cb-f20d-4569-a58e-6009c89ea049')
49    def test_screen_OFF_bt_ON_ble_ON_connectable(self):
50        self.bt_baseline_test_func()
51
52    @test_tracker_info(uuid='d54a992e-37ed-460a-ada7-2c51941557fd')
53    def test_screen_OFF_bt_ON_ble_ON_discoverable(self):
54        self.bt_baseline_test_func()
55
56    @test_tracker_info(uuid='8f4c36b5-b18e-4aa5-9fe5-aafb729c1034')
57    def test_screen_ON_bt_ON_ble_ON_connectable(self):
58        self.bt_baseline_test_func()
59
60    @test_tracker_info(uuid='7128356f-67d8-46b3-9d6b-1a4c9a7a1745')
61    def test_screen_ON_bt_ON_ble_ON_discoverable(self):
62        self.bt_baseline_test_func()
63