tree: 5a5ab8f53e37dec24dd78e8c22a742cb5ab26443 [path history] [tgz]
  1. android/
  2. dbus/
  3. strings/
  4. test/
  5. uribeacon/
  6. bluetooth.gyp
  7. bluetooth_adapter.cc
  8. bluetooth_adapter.h
  9. bluetooth_adapter_android.cc
  10. bluetooth_adapter_android.h
  11. bluetooth_adapter_bluez.cc
  12. bluetooth_adapter_bluez.h
  13. bluetooth_adapter_factory.cc
  14. bluetooth_adapter_factory.h
  15. bluetooth_adapter_mac.h
  16. bluetooth_adapter_mac.mm
  17. bluetooth_adapter_mac_unittest.mm
  18. bluetooth_adapter_profile_bluez.cc
  19. bluetooth_adapter_profile_bluez.h
  20. bluetooth_adapter_profile_bluez_unittest.cc
  21. bluetooth_adapter_stub.cc
  22. bluetooth_adapter_unittest.cc
  23. bluetooth_adapter_win.cc
  24. bluetooth_adapter_win.h
  25. bluetooth_adapter_win_unittest.cc
  26. bluetooth_advertisement.cc
  27. bluetooth_advertisement.h
  28. bluetooth_advertisement_bluez.cc
  29. bluetooth_advertisement_bluez.h
  30. bluetooth_advertisement_bluez_unittest.cc
  31. bluetooth_advertisement_unittest.cc
  32. bluetooth_audio_sink.cc
  33. bluetooth_audio_sink.h
  34. bluetooth_audio_sink_bluez.cc
  35. bluetooth_audio_sink_bluez.h
  36. bluetooth_audio_sink_bluez_unittest.cc
  37. bluetooth_bluez_unittest.cc
  38. bluetooth_channel_mac.h
  39. bluetooth_channel_mac.mm
  40. bluetooth_classic_device_mac.h
  41. bluetooth_classic_device_mac.mm
  42. bluetooth_classic_win.cc
  43. bluetooth_classic_win.h
  44. bluetooth_classic_win_fake.cc
  45. bluetooth_classic_win_fake.h
  46. bluetooth_device.cc
  47. bluetooth_device.h
  48. bluetooth_device_android.cc
  49. bluetooth_device_android.h
  50. bluetooth_device_bluez.cc
  51. bluetooth_device_bluez.h
  52. bluetooth_device_mac.h
  53. bluetooth_device_mac.mm
  54. bluetooth_device_unittest.cc
  55. bluetooth_device_win.cc
  56. bluetooth_device_win.h
  57. bluetooth_device_win_unittest.cc
  58. bluetooth_discovery_filter.cc
  59. bluetooth_discovery_filter.h
  60. bluetooth_discovery_filter_unittest.cc
  61. bluetooth_discovery_manager_mac.h
  62. bluetooth_discovery_manager_mac.mm
  63. bluetooth_discovery_session.cc
  64. bluetooth_discovery_session.h
  65. bluetooth_discovery_session_outcome.h
  66. bluetooth_export.h
  67. bluetooth_gatt_bluez_unittest.cc
  68. bluetooth_gatt_characteristic.cc
  69. bluetooth_gatt_characteristic.h
  70. bluetooth_gatt_characteristic_unittest.cc
  71. bluetooth_gatt_connection.cc
  72. bluetooth_gatt_connection.h
  73. bluetooth_gatt_connection_bluez.cc
  74. bluetooth_gatt_connection_bluez.h
  75. bluetooth_gatt_descriptor.cc
  76. bluetooth_gatt_descriptor.h
  77. bluetooth_gatt_descriptor_unittest.cc
  78. bluetooth_gatt_notify_session.cc
  79. bluetooth_gatt_notify_session.h
  80. bluetooth_gatt_notify_session_android.cc
  81. bluetooth_gatt_notify_session_android.h
  82. bluetooth_gatt_notify_session_bluez.cc
  83. bluetooth_gatt_notify_session_bluez.h
  84. bluetooth_gatt_service.cc
  85. bluetooth_gatt_service.h
  86. bluetooth_gatt_service_unittest.cc
  87. bluetooth_init_win.cc
  88. bluetooth_init_win.h
  89. bluetooth_l2cap_channel_mac.h
  90. bluetooth_l2cap_channel_mac.mm
  91. bluetooth_low_energy_central_manager_delegate.h
  92. bluetooth_low_energy_central_manager_delegate.mm
  93. bluetooth_low_energy_defs_win.cc
  94. bluetooth_low_energy_defs_win.h
  95. bluetooth_low_energy_device_mac.h
  96. bluetooth_low_energy_device_mac.mm
  97. bluetooth_low_energy_discovery_manager_mac.h
  98. bluetooth_low_energy_discovery_manager_mac.mm
  99. bluetooth_low_energy_win.cc
  100. bluetooth_low_energy_win.h
  101. bluetooth_low_energy_win_fake.cc
  102. bluetooth_low_energy_win_fake.h
  103. bluetooth_low_energy_win_unittest.cc
  104. bluetooth_pairing_bluez.cc
  105. bluetooth_pairing_bluez.h
  106. bluetooth_remote_gatt_characteristic_android.cc
  107. bluetooth_remote_gatt_characteristic_android.h
  108. bluetooth_remote_gatt_characteristic_bluez.cc
  109. bluetooth_remote_gatt_characteristic_bluez.h
  110. bluetooth_remote_gatt_characteristic_win.cc
  111. bluetooth_remote_gatt_characteristic_win.h
  112. bluetooth_remote_gatt_descriptor_android.cc
  113. bluetooth_remote_gatt_descriptor_android.h
  114. bluetooth_remote_gatt_descriptor_bluez.cc
  115. bluetooth_remote_gatt_descriptor_bluez.h
  116. bluetooth_remote_gatt_descriptor_win.cc
  117. bluetooth_remote_gatt_descriptor_win.h
  118. bluetooth_remote_gatt_service_android.cc
  119. bluetooth_remote_gatt_service_android.h
  120. bluetooth_remote_gatt_service_bluez.cc
  121. bluetooth_remote_gatt_service_bluez.h
  122. bluetooth_remote_gatt_service_win.cc
  123. bluetooth_remote_gatt_service_win.h
  124. bluetooth_rfcomm_channel_mac.h
  125. bluetooth_rfcomm_channel_mac.mm
  126. bluetooth_service_record_win.cc
  127. bluetooth_service_record_win.h
  128. bluetooth_service_record_win_unittest.cc
  129. bluetooth_socket.cc
  130. bluetooth_socket.h
  131. bluetooth_socket_bluez.cc
  132. bluetooth_socket_bluez.h
  133. bluetooth_socket_bluez_unittest.cc
  134. bluetooth_socket_mac.h
  135. bluetooth_socket_mac.mm
  136. bluetooth_socket_net.cc
  137. bluetooth_socket_net.h
  138. bluetooth_socket_thread.cc
  139. bluetooth_socket_thread.h
  140. bluetooth_socket_win.cc
  141. bluetooth_socket_win.h
  142. bluetooth_strings.grd
  143. bluetooth_strings.gyp
  144. bluetooth_task_manager_win.cc
  145. bluetooth_task_manager_win.h
  146. bluetooth_task_manager_win_unittest.cc
  147. bluetooth_uuid.cc
  148. bluetooth_uuid.h
  149. bluetooth_uuid_unittest.cc
  150. BUILD.gn
  151. DEPS
  152. OWNERS
  153. README.md
device/bluetooth/README.md

Bluetooth

device/bluetooth abstracts Bluetooth Classic and Low Energy features across multiple platforms.

Classic and Low Energy based profiles differ substantially. Platform implementations may support only one or the other, even though several classes have interfaces for both, e.g. BluetoothAdapter & BluetoothDevice.

ClassicLow Energy
Androidnoin progress
ChromeOSyesyes
Linuxyesyes
Mac OSXyesin progress
Windowssomein progress

ChromeOS and Linux are supported via BlueZ, see *_bluez files.

Maintainer History

Initial implementation OWNERS were youngki@chromium.org, keybuk@chromium.org, armansito@chromium.org, and rpaquay@chromium.org. They no longer contribute to chromium fulltime. They were responsible for support for ChromeOS Bluetooth features and the Chrome Apps APIs:

Active development in 2015 & 2016 is focused on enabling GATT features for:

Known future work is tracked in the Refactoring meta issue.

Testing

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

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.

ChromeOS Blueooth Controller Tests

Bluetooth controller system tests generating radio signals are run and managed by the ChromeOS 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/

Android

The android implementation requires crossing from C++ to Java using JNI.

Object ownership is rooted in the C++ classes, starting with the Adapter, which owns Devices, Services, etc. Java counter parts interface with the Android Bluetooth objects. E.g.

For testing, the Android objects are wrapped in: android/java/src/org/chromium/device/bluetooth/Wrappers.java.
and fakes implemented in: test/android/java/src/org/chromium/device/bluetooth/Fakes.java.

Thus:

  • bluetooth_adapter_android.h owns:
    • android/.../ChromeBluetoothAdapter.java uses:
      • android/.../Wrappers.java: BluetoothAdapterWrapper
        • Which under test is a FakeBluetoothAdapter
    • bluetooth_device_android.h owns:
      • android/.../ChromeBluetoothDevice.java uses:
        • android/.../Wrappers.java: BluetoothDeviceWrapper
          • Which under test is a FakeBluetoothDevice
      • bluetooth_gatt_service_android.h owns:
        • android/.../ChromeBluetoothService.java uses:
          • android/.../Wrappers.java: BluetoothServiceWrapper
            • Which under test is a FakeBluetoothService
        • ... and so on for characteristics and descriptors.

Fake objects are controlled by bluetooth_test_android.cc.

See also: Class Diagram of Web Bluetooth through Bluetooth Android