aboutsummaryrefslogtreecommitdiff
path: root/gd/hci/cert/controller_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'gd/hci/cert/controller_test.py')
-rw-r--r--gd/hci/cert/controller_test.py73
1 files changed, 57 insertions, 16 deletions
diff --git a/gd/hci/cert/controller_test.py b/gd/hci/cert/controller_test.py
index 20fe937e6..6dc23c429 100644
--- a/gd/hci/cert/controller_test.py
+++ b/gd/hci/cert/controller_test.py
@@ -16,30 +16,71 @@
import time
-from cert.gd_base_test import GdBaseTestClass
-from cert.truth import assertThat
+from acts import asserts
+from cert.gd_base_test_facade_only import GdFacadeOnlyBaseTestClass
from google.protobuf import empty_pb2 as empty_proto
from facade import rootservice_pb2 as facade_rootservice
from hci.facade import controller_facade_pb2 as controller_facade
-class ControllerTest(GdBaseTestClass):
+class ControllerTest(GdFacadeOnlyBaseTestClass):
- def setup_class(self):
- super().setup_class(dut_module='HCI_INTERFACES', cert_module='HCI_INTERFACES')
+ def setup_test(self):
+ self.device_under_test.rootservice.StartStack(
+ facade_rootservice.StartStackRequest(
+ module_under_test=facade_rootservice.BluetoothModule.Value(
+ 'HCI_INTERFACES'),))
+ self.cert_device.rootservice.StartStack(
+ facade_rootservice.StartStackRequest(
+ module_under_test=facade_rootservice.BluetoothModule.Value(
+ 'HCI_INTERFACES'),))
- def test_get_addresses(self):
- cert_address = self.cert.hci_controller.GetMacAddressSimple()
- dut_address = self.dut.hci_controller.GetMacAddressSimple()
+ self.device_under_test.wait_channel_ready()
+ self.cert_device.wait_channel_ready()
+
+ def teardown_test(self):
+ self.device_under_test.rootservice.StopStack(
+ facade_rootservice.StopStackRequest())
+ self.cert_device.rootservice.StopStack(
+ facade_rootservice.StopStackRequest())
- assertThat(cert_address).isNotEqualTo(dut_address)
+ def test_get_addresses(self):
+ cert_address_response = self.cert_device.hci_controller.GetMacAddress(
+ empty_proto.Empty())
+ dut_address_response = self.device_under_test.hci_controller.GetMacAddress(
+ empty_proto.Empty())
+ asserts.assert_true(
+ cert_address_response.address != dut_address_response.address,
+ msg="Expected cert and dut address to be different %s" %
+ cert_address_response.address)
time.sleep(1) # This shouldn't be needed b/149120542
- def test_write_local_name(self):
- self.dut.hci_controller.WriteLocalName(controller_facade.NameMsg(name=b'ImTheDUT'))
- self.cert.hci_controller.WriteLocalName(controller_facade.NameMsg(name=b'ImTheCert'))
- cert_name = self.cert.hci_controller.GetLocalNameSimple()
- dut_name = self.dut.hci_controller.GetLocalNameSimple()
+ def test_get_local_extended_features(self):
+ request = controller_facade.PageNumberMsg()
+ request.page_number = 1
+ dut_feature_response1 = self.device_under_test.hci_controller.GetLocalExtendedFeatures(
+ request)
+ request0 = controller_facade.PageNumberMsg()
+ request0.page_number = 0
+ dut_feature_response0 = self.device_under_test.hci_controller.GetLocalExtendedFeatures(
+ request0)
+ asserts.assert_true(
+ dut_feature_response1.page != dut_feature_response0.page,
+ msg="Expected cert dut feature pages to be different %d" %
+ dut_feature_response1.page)
- assertThat(dut_name).isEqualTo(b'ImTheDUT')
- assertThat(cert_name).isEqualTo(b'ImTheCert')
+ def test_write_local_name(self):
+ self.device_under_test.hci_controller.WriteLocalName(
+ controller_facade.NameMsg(name=b'ImTheDUT'))
+ self.cert_device.hci_controller.WriteLocalName(
+ controller_facade.NameMsg(name=b'ImTheCert'))
+ cert_name_msg = self.cert_device.hci_controller.GetLocalName(
+ empty_proto.Empty()).name
+ dut_name_msg = self.device_under_test.hci_controller.GetLocalName(
+ empty_proto.Empty()).name
+ asserts.assert_true(
+ dut_name_msg == b'ImTheDUT',
+ msg="unexpected dut name %s" % dut_name_msg)
+ asserts.assert_true(
+ cert_name_msg == b'ImTheCert',
+ msg="unexpected cert name %s" % cert_name_msg)