1#!/usr/bin/env python3 2# 3# Copyright (C) 2020 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); you may not 6# use this file except in compliance with the License. You may obtain a copy of 7# 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, WITHOUT 13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14# License for the specific language governing permissions and limitations under 15# the License. 16""" 17Script for verifying that we can invoke methods of the WlanFacade. 18 19""" 20from acts.base_test import BaseTestClass 21from acts import asserts, signals 22 23 24class WlanFacadeTest(BaseTestClass): 25 def setup_class(self): 26 super().setup_class() 27 if len(self.fuchsia_devices) < 1: 28 raise signals.TestAbortClass( 29 "Sorry, please try verifying FuchsiaDevice is in your " 30 "config file and try again.") 31 32 def test_get_phy_id_list(self): 33 result = self.fuchsia_devices[0].wlan_lib.wlanPhyIdList() 34 error = result['error'] 35 asserts.assert_true(error is None, error) 36 37 self.log.info('Got Phy IDs %s' % result['result']) 38 return True 39 40 def test_get_country(self): 41 wlan_lib = self.fuchsia_devices[0].wlan_lib 42 43 result = wlan_lib.wlanPhyIdList() 44 error = result['error'] 45 asserts.assert_true(error is None, error) 46 phy_id = result['result'][0] 47 48 result = wlan_lib.wlanGetCountry(phy_id) 49 error = result['error'] 50 asserts.assert_true(error is None, error) 51 52 country_bytes = result['result'] 53 country_string = str(array.array('b', country_bytes), 54 encoding='us-ascii') 55 self.log.info('Got country %s (%s)', country_string, country_bytes) 56 return True 57