RFCOMM: Add unit tests for connection scenarios
Unit tests: * Add net_test_stack_rfcomm * Use a compiler trick to compile production RFCOMM code against L2CAP and BTM header, but fake L2CAP and BTM source code so that we can stub statically defined L2CAP and BTM code using mocks * Rename net_test_rfcomm to net_test_rfcomm_suite * Add mocked L2CAP and BTM layer to allow packet replay from L2CAP layer to RFCOMM layer in order to reproduce time dependent issues such as connection collision * Add a number of utility methods that generates RFCOMM packet bytes using supported parameters * Add unit test for above utility methods * Add suite of unit tests named StackRfcommTest, including: - SingleServerConnectionHelloWorld - MultiServerPortSameDeviceHelloWorld - SameServerPortMultiDeviceHelloWorld - SingleClientConnectionHelloWorld - SameClientPortMultiDeviceHelloWorld * These tests supply L2CAP packets and API calls to trigger RFCOMM connection setup in various scenarios * Added logging method to output debug log via VLOG(1) logging level and allow compile time configuration of these logs through a constant flag Bug: 77224743 Test: ./test/run_unit_tests.sh net_test_stack_rfcomm testplans/details/158641/3975 Change-Id: I9d59843603cd36394c3736670bcf3c39dea26674
Showing
- system/stack/Android.bp 53 additions, 1 deletionsystem/stack/Android.bp
- system/stack/test/common/mock_btm_layer.cc 45 additions, 0 deletionssystem/stack/test/common/mock_btm_layer.cc
- system/stack/test/common/mock_btm_layer.h 57 additions, 0 deletionssystem/stack/test/common/mock_btm_layer.h
- system/stack/test/common/mock_btu_layer.cc 21 additions, 0 deletionssystem/stack/test/common/mock_btu_layer.cc
- system/stack/test/common/mock_l2cap_layer.cc 59 additions, 0 deletionssystem/stack/test/common/mock_l2cap_layer.cc
- system/stack/test/common/mock_l2cap_layer.h 65 additions, 0 deletionssystem/stack/test/common/mock_l2cap_layer.h
- system/stack/test/common/stack_test_packet_utils.cc 96 additions, 0 deletionssystem/stack/test/common/stack_test_packet_utils.cc
- system/stack/test/common/stack_test_packet_utils.h 78 additions, 0 deletionssystem/stack/test/common/stack_test_packet_utils.h
- system/stack/test/rfcomm/stack_rfcomm_test.cc 715 additions, 0 deletionssystem/stack/test/rfcomm/stack_rfcomm_test.cc
- system/stack/test/rfcomm/stack_rfcomm_test_main.cc 74 additions, 0 deletionssystem/stack/test/rfcomm/stack_rfcomm_test_main.cc
- system/stack/test/rfcomm/stack_rfcomm_test_utils.cc 223 additions, 0 deletionssystem/stack/test/rfcomm/stack_rfcomm_test_utils.cc
- system/stack/test/rfcomm/stack_rfcomm_test_utils.h 232 additions, 0 deletionssystem/stack/test/rfcomm/stack_rfcomm_test_utils.h
- system/stack/test/rfcomm/stack_rfcomm_test_utils_test.cc 246 additions, 0 deletionssystem/stack/test/rfcomm/stack_rfcomm_test_utils_test.cc
- system/test/run_unit_tests.sh 2 additions, 1 deletionsystem/test/run_unit_tests.sh
- system/test/suite/Android.bp 1 addition, 1 deletionsystem/test/suite/Android.bp
Loading
Please register or sign in to comment