Commit Graph

5 Commits (feature-bluetooth-unit-test)

Author SHA1 Message Date
Paul Szczepanek 5ff2b23ec9 null pointers 2021-02-10 17:35:12 +00:00
Vincent Coubard ce0917f00b
Merge pull request #14254 from pan-/fake-gatt-server-add
Add implementation of MockGattServer::addService
2021-02-10 16:24:53 +00:00
Paul Szczepanek 293883d3e0 offer delete mocks function 2021-02-10 14:39:31 +00:00
Vincent Coubard 0feaae6d18 Add fake implementation for GattServerMock::addService.
It is not easy to write expectations for this function:
- The data in input is a complex tree that is not comparable.
- The data in input is modified: The attributes of each element of
the tree is added by the server.

To ease test, a default implementation has been added but it is
still possible to override it or set expectations.
That default implementation set unique attribute handles for
each element of the service and _copy_ it in the GattServerMock.

The copy does *not* follow standard BLE API, it is a _POD_ where
each element of the object is accessible as a field. Childs are
stored in vector to ease iteration and memory management.

The representation of the services registered into the mock are
accessible in GattServerMock::services.
2021-02-10 11:26:25 +00:00
Paul Szczepanek 164bb83274
Add Bluetooth stubs as libs (#14229)
* add stubs as libs

* split up stubs and fakes

* use correct types in fake event queue

* allow arguments in fake event queue callbacks

* remove dispatch forever

* remove redundant call signature

* return false on cancel with invalid id

* return queue size
2021-02-09 14:52:30 +00:00