tree: 7100a85e0328578dc734ccafd834325b1e6eee7d [path history] [tgz]
  1. android/
  2. bluetooth_gatt_server_test.cc
  3. bluetooth_gatt_server_test.h
  4. bluetooth_test.cc
  5. bluetooth_test.h
  6. bluetooth_test_android.cc
  7. bluetooth_test_android.h
  8. bluetooth_test_bluez.cc
  9. bluetooth_test_bluez.h
  10. bluetooth_test_cast.cc
  11. bluetooth_test_cast.h
  12. bluetooth_test_fuchsia.cc
  13. bluetooth_test_fuchsia.h
  14. bluetooth_test_mac.h
  15. bluetooth_test_mac.mm
  16. bluetooth_test_win.cc
  17. bluetooth_test_win.h
  18. fake_bluetooth.cc
  19. fake_bluetooth.h
  20. fake_bluetooth_adapter_winrt.cc
  21. fake_bluetooth_adapter_winrt.h
  22. fake_bluetooth_le_advertisement_data_section_winrt.cc
  23. fake_bluetooth_le_advertisement_data_section_winrt.h
  24. fake_bluetooth_le_advertisement_publisher_status_changed_event_args_winrt.cc
  25. fake_bluetooth_le_advertisement_publisher_status_changed_event_args_winrt.h
  26. fake_bluetooth_le_advertisement_publisher_winrt.cc
  27. fake_bluetooth_le_advertisement_publisher_winrt.h
  28. fake_bluetooth_le_advertisement_received_event_args_winrt.cc
  29. fake_bluetooth_le_advertisement_received_event_args_winrt.h
  30. fake_bluetooth_le_advertisement_watcher_winrt.cc
  31. fake_bluetooth_le_advertisement_watcher_winrt.h
  32. fake_bluetooth_le_advertisement_winrt.cc
  33. fake_bluetooth_le_advertisement_winrt.h
  34. fake_bluetooth_le_device_winrt.cc
  35. fake_bluetooth_le_device_winrt.h
  36. fake_bluetooth_le_manufacturer_data_winrt.cc
  37. fake_bluetooth_le_manufacturer_data_winrt.h
  38. fake_bluetooth_socket.cc
  39. fake_bluetooth_socket.h
  40. fake_central.cc
  41. fake_central.h
  42. fake_device_information_custom_pairing_winrt.cc
  43. fake_device_information_custom_pairing_winrt.h
  44. fake_device_information_pairing_winrt.cc
  45. fake_device_information_pairing_winrt.h
  46. fake_device_information_winrt.cc
  47. fake_device_information_winrt.h
  48. fake_device_pairing_requested_event_args_winrt.cc
  49. fake_device_pairing_requested_event_args_winrt.h
  50. fake_device_pairing_result_winrt.cc
  51. fake_device_pairing_result_winrt.h
  52. fake_device_watcher_winrt.cc
  53. fake_device_watcher_winrt.h
  54. fake_gatt_characteristic_winrt.cc
  55. fake_gatt_characteristic_winrt.h
  56. fake_gatt_characteristics_result_winrt.cc
  57. fake_gatt_characteristics_result_winrt.h
  58. fake_gatt_descriptor_winrt.cc
  59. fake_gatt_descriptor_winrt.h
  60. fake_gatt_descriptors_result_winrt.cc
  61. fake_gatt_descriptors_result_winrt.h
  62. fake_gatt_device_service_winrt.cc
  63. fake_gatt_device_service_winrt.h
  64. fake_gatt_device_services_result_winrt.cc
  65. fake_gatt_device_services_result_winrt.h
  66. fake_gatt_read_result_winrt.cc
  67. fake_gatt_read_result_winrt.h
  68. fake_gatt_session_winrt.cc
  69. fake_gatt_session_winrt.h
  70. fake_gatt_value_changed_event_args_winrt.cc
  71. fake_gatt_value_changed_event_args_winrt.h
  72. fake_gatt_write_result_winrt.cc
  73. fake_gatt_write_result_winrt.h
  74. fake_peripheral.cc
  75. fake_peripheral.h
  76. fake_radio_winrt.cc
  77. fake_radio_winrt.h
  78. fake_read_response.cc
  79. fake_read_response.h
  80. fake_remote_gatt_characteristic.cc
  81. fake_remote_gatt_characteristic.h
  82. fake_remote_gatt_descriptor.cc
  83. fake_remote_gatt_descriptor.h
  84. fake_remote_gatt_service.cc
  85. fake_remote_gatt_service.h
  86. mock_bluetooth_adapter.cc
  87. mock_bluetooth_adapter.h
  88. mock_bluetooth_advertisement.cc
  89. mock_bluetooth_advertisement.h
  90. mock_bluetooth_cbcharacteristic_mac.h
  91. mock_bluetooth_cbcharacteristic_mac.mm
  92. mock_bluetooth_cbdescriptor_mac.h
  93. mock_bluetooth_cbdescriptor_mac.mm
  94. mock_bluetooth_cbperipheral_mac.h
  95. mock_bluetooth_cbperipheral_mac.mm
  96. mock_bluetooth_cbservice_mac.h
  97. mock_bluetooth_cbservice_mac.mm
  98. mock_bluetooth_central_manager_mac.h
  99. mock_bluetooth_central_manager_mac.mm
  100. mock_bluetooth_device.cc
  101. mock_bluetooth_device.h
  102. mock_bluetooth_gatt_characteristic.cc
  103. mock_bluetooth_gatt_characteristic.h
  104. mock_bluetooth_gatt_connection.cc
  105. mock_bluetooth_gatt_connection.h
  106. mock_bluetooth_gatt_descriptor.cc
  107. mock_bluetooth_gatt_descriptor.h
  108. mock_bluetooth_gatt_notify_session.cc
  109. mock_bluetooth_gatt_notify_session.h
  110. mock_bluetooth_gatt_service.cc
  111. mock_bluetooth_gatt_service.h
  112. mock_bluetooth_low_energy_scan_session.cc
  113. mock_bluetooth_low_energy_scan_session.h
  114. mock_bluetooth_socket.cc
  115. mock_bluetooth_socket.h
  116. mock_pairing_delegate.cc
  117. mock_pairing_delegate.h
  118. README.md
  119. test_bluetooth_adapter_observer.cc
  120. test_bluetooth_adapter_observer.h
  121. test_bluetooth_advertisement_observer.cc
  122. test_bluetooth_advertisement_observer.h
  123. test_bluetooth_local_gatt_service_delegate.cc
  124. test_bluetooth_local_gatt_service_delegate.h
device/bluetooth/test/README.md

Bluetooth Testing

This page describes testing APIs for both clients and implementation of the Bluetooth component.

There are also notable higher level bluetooth tests:

Client Testing

Mock Bluetooth Objects

test/mock_bluetooth_* files provide GoogleMock based fake objects that subclass the cross platform C++ device/bluetooth API.

These are used by numerous clients and are stable.

Fake Bluetooth Mojo Testing Interface Implementation

WORK IN PROGRESS.

Web Platform Tests for Web Bluetooth are being refactored to use third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js.

That library is implemented over a mojo interface fake_bluetooth.mojom in bluetooth/public/mojom/test and is implemented in the bluetooth/test/fake_* files.

The fake_bluetooth.mojom interface is not intended to be used directly. web-bluetooth-test.js makes the Fake Bluetooth interface easier to work with.

  • Calls are synchronous.
  • IDs are cached.

If another C++ client intends to use Fake Bluetooth a C++ wrapper similar to web-bluetooth-test.js should be created.

When a Bluetooth service is created the fake_bluetooth.mojom and bluetooth/test/fake_* files should be removed and the client facing test wrapper web-bluetooth-test.js converted to implement the Bluetooth service as needed for tests.

Design Doc: https://docs.google.com/document/d/1Nhv_oVDCodd1pEH_jj9k8gF4rPGb_84VYaZ9IG8M_WY

Implementation Testing

Cross Platform Unit Tests

New feature development uses cross platform unit tests. This reduces test code redundancy and produces consistency across all implementations.

Unit tests operate at the public device/bluetooth API layer and the BluetoothTest fixture controls fake operating system behavior as close to the platfom as possible. The resulting test coverage spans the cross platform API, common implementation, and platform specific implementation as close to operating system APIs as possible.

test/bluetooth_test.h defines the cross platform test fixture BluetoothTestBase. Platform implementations provide subclasses, such as test/bluetooth_test_android.h and typedef to the name BluetoothTest.

More testing information

Legacy Platform Specific Unit Tests

Early code (Classic on most platforms, and Low Energy on BlueZ) was tested with platform specific unit tests, e.g. bluetooth_bluez_unittest.cc & bluetooth_adapter_win_unittest.cc. The BlueZ style has platform specific methods to create fake devices and the public API is used to interact with them.

Maintenance of these earlier implementation featuress should update tests in place. Long term these tests should be refactored into cross platform tests.

Chrome OS Blueooth Controller Tests

Bluetooth controller system tests generating radio signals are run and managed by the Chrome OS team. See: https://chromium.googlesource.com/chromiumos/third_party/autotest/+/main/server/site_tests/ https://chromium.googlesource.com/chromiumos/third_party/autotest/+/main/server/cros/bluetooth/ https://chromium.googlesource.com/chromiumos/third_party/autotest/+/main/client/cros/bluetooth/