• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2#   Copyright 2021 - The Android Open Source Project
3#
4#   Licensed under the Apache License, Version 2.0 (the "License");
5#   you may not use this file except in compliance with the License.
6#   You may obtain a copy of the License at
7#
8#   http://www.apache.org/licenses/LICENSE-2.0
9#
10#   Unless required by applicable law or agreed to in writing, software
11#   distributed under the License is distributed on an "AS IS" BASIS,
12#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13#   See the License for the specific language governing permissions and
14#   limitations under the License.
15
16import time
17from acts.test_decorators import test_tracker_info
18from acts_contrib.test_utils.wifi import wifi_test_utils as wutils
19from acts_contrib.test_utils.wifi.WifiBaseTest import WifiBaseTest
20from WifiPnoTest import WifiPnoTest
21
22MAX_ATTN = 95
23
24
25class WifiPno6eTest(WifiPnoTest):
26  """Tests for pno for 6ghz.
27
28  Test Bed Requirement:
29    1 Android devices, 2 Asus AXE11000 Access Point.
30  """
31
32  def __init__(self, configs):
33    super().__init__(configs)
34    self.tests = (
35        "test_simple_pno_connection_to_6G",
36        "test_pno_connection_with_multiple_saved_networks",
37    )
38
39  def setup_class(self):
40    WifiBaseTest.setup_class(self)
41
42    self.dut = self.android_devices[0]
43    req_params = [
44        "attn_vals", "pno_interval", "reference_networks", "wifi6_models"
45    ]
46    self.unpack_userparams(req_param_names=req_params,)
47    self.attn_a = self.attenuators[0]
48    self.attn_b = self.attenuators[1]
49    self.attenuators[2].set_atten(MAX_ATTN)
50    self.attenuators[3].set_atten(MAX_ATTN)
51    self.set_attns("default")
52    self.pno_network_a = self.reference_networks[0]["2g"]
53    self.pno_network_b = self.reference_networks[0]["6g"]
54
55  def teardown_class(self):
56    WifiBaseTest.teardown_class(self)
57    self.attenuators[2].set_atten(0)
58    self.attenuators[3].set_atten(0)
59
60  ### Tests ###
61
62  @test_tracker_info(uuid="4367138e-8c29-40f2-a963-44094223e525")
63  def test_simple_pno_connection_to_6G(self):
64    self.add_network_and_enable(self.pno_network_a)
65    self.add_network_and_enable(self.pno_network_b)
66    self.trigger_pno_and_assert_connect("b_on_a_off", self.pno_network_b)
67
68  @test_tracker_info(uuid="fb147268-87bb-4403-a971-ce3e0bd36d2c")
69  def test_pno_connection_with_multiple_saved_networks(self):
70    self.add_and_enable_test_networks(16)
71    self.add_network_and_enable(self.pno_network_a)
72    self.add_network_and_enable(self.pno_network_b)
73    # Force single scan so that both networks become preferred before PNO.
74    wutils.start_wifi_connection_scan_and_return_status(self.dut)
75    self.dut.droid.goToSleepNow()
76    wutils.wifi_toggle_state(self.dut, False)
77    wutils.wifi_toggle_state(self.dut, True)
78    time.sleep(10)
79    self.trigger_pno_and_assert_connect("b_on_a_off", self.pno_network_b)
80
81