tree: ee392f88e97df5339faa1cc6dbb1a2d9f3020773 [path history] [tgz]
  1. meta/
  2. src/
  3. BUILD.gn
  4. README.md
src/connectivity/bluetooth/testing/mock-piconet-server/README.md

Mock Piconet Server

The Mock Piconet Server (MPS) component is used in integration tests for the Bluetooth profiles.

The server manages a fake piconet of peers, and simulates the behavior of the Profile Server. The component implements the ProfileTest protocol, which can be used to register mock peers in the piconet, launch profiles to test, and drive peer behavior. The server supports establishing L2CAP connections. For RFCOMM connections, test writers should use the RFCOMM component as an intermediary.

The Mock Piconet Server currently supports integration tests written in both CFv1 and CFv2 frameworks. Integration test authors should use the CFv2 variant of the MPS.

Build Configuration

To include the mock piconet server and its tests in your build, add:

--with //src/connectivity/bluetooth/testing/mock-piconet-server and --with //src/connectivity/bluetooth/testing/mock-piconet-server:tests to your fx set.

To run the unit tests for the server: fx test mock-piconet-server-tests.

The Mock Piconet Server is referenced using a relative URL. Make sure to include the MPS component in the deps of your integration test package.

Library

The Mock Piconet Server provides a client-facing library of utilities to launch and interact with the server. To use the tools provided in the library, add //src/connectivity/bluetooth/testing/mock-piconet-server:lib_v2 to the BUILD.gn of your test component.

Examples

For CFv1, import the ProfileTestHarness to your test to get started. Instantiate the ProfileTestHarness and register mock peers using the ProfileTestHarness::register_peer method. You can then emulate peer behavior by either operating directly on the mock peer or launching a Bluetooth profile. For an example using the v1 framework, check out the A2DP Source Integration Tests.

For CFv2, import the PiconetHarness to your test to get started. Define the topology by adding profiles-under-test or mock piconet members to be driven by the test code. Use the CFv2 Library to route capabilities needed & exposed by the test. For an example using the v2 framework, check out the AVRCP Integration Tests.