tree: 9afa97b23755da5a2f43f7f0ec8bcfab58c91f4e [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_mac.h
  11. bluetooth_test_mac.mm
  12. bluetooth_test_win.cc
  13. bluetooth_test_win.h
  14. fake_bluetooth.cc
  15. fake_bluetooth.h
  16. fake_central.cc
  17. fake_central.h
  18. fake_peripheral.cc
  19. fake_peripheral.h
  20. mock_bluetooth_adapter.cc
  21. mock_bluetooth_adapter.h
  22. mock_bluetooth_advertisement.cc
  23. mock_bluetooth_advertisement.h
  24. mock_bluetooth_cbcharacteristic_mac.h
  25. mock_bluetooth_cbcharacteristic_mac.mm
  26. mock_bluetooth_cbdescriptor_mac.h
  27. mock_bluetooth_cbdescriptor_mac.mm
  28. mock_bluetooth_cbperipheral_mac.h
  29. mock_bluetooth_cbperipheral_mac.mm
  30. mock_bluetooth_cbservice_mac.h
  31. mock_bluetooth_cbservice_mac.mm
  32. mock_bluetooth_central_manager_mac.h
  33. mock_bluetooth_central_manager_mac.mm
  34. mock_bluetooth_device.cc
  35. mock_bluetooth_device.h
  36. mock_bluetooth_discovery_session.cc
  37. mock_bluetooth_discovery_session.h
  38. mock_bluetooth_gatt_characteristic.cc
  39. mock_bluetooth_gatt_characteristic.h
  40. mock_bluetooth_gatt_connection.cc
  41. mock_bluetooth_gatt_connection.h
  42. mock_bluetooth_gatt_descriptor.cc
  43. mock_bluetooth_gatt_descriptor.h
  44. mock_bluetooth_gatt_notify_session.cc
  45. mock_bluetooth_gatt_notify_session.h
  46. mock_bluetooth_gatt_service.cc
  47. mock_bluetooth_gatt_service.h
  48. mock_bluetooth_socket.cc
  49. mock_bluetooth_socket.h
  50. README.md
  51. test_bluetooth_adapter_observer.cc
  52. test_bluetooth_adapter_observer.h
  53. test_bluetooth_local_gatt_service_delegate.cc
  54. test_bluetooth_local_gatt_service_delegate.h
device/bluetooth/test/README.md

Bluetooth Testing

Implementation of the Bluetooth component is tested via unittests. Client code uses Mock Bluetooth objects:

Mojo Testing Interface Implementation

See bluetooth/public/interfaces/test for details about the interface. The current implementation of this interface creates a fake implementation of the current non-mojo C++ Bluetooth interface. This interface is implemented across files with a “fake_” prefix. This interface may be removed when a Bluetooth Mojo Service is introduced, if Web Bluetooth remains its only client. Testing code would implement the service as needed for tests.

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.

Mock Bluetooth Objects

test/mock_bluetooth_* files provide GoogleMock based fake objects for use in client code.

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/+/master/server/site_tests/ https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/server/cros/bluetooth/ https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/client/cros/bluetooth/