template <typename Driver = void>

class DriverUnderTest

Defined at line 101 of file ../../sdk/lib/driver/testing/cpp/internal/driver_lifecycle.h

This is a RAII wrapper over a driver under test. On construction it initializes the driver server

and on destruction it destroys the driver server.

The |Driver| type given in the template is used to provide pass-through `->` and `*` operators

to the given driver type.

To use this class, ensure that the driver has been exported into the

__fuchsia_driver_registration__ symbol using the FUCHSIA_DRIVER macros. Otherwise pass the

DriverRegistration manually into this class.

# Thread safety

This class is thread-unsafe. Instances must be managed and used from a synchronized dispatcher.

See

https://fuchsia.dev/fuchsia-src/development/languages/c-cpp/thread-safe-async#synchronized-dispatcher

If the driver dispatcher is the foreground dispatcher, the DriverUnderTest does not need to be

wrapped in a DispatcherBound.

If the driver dispatcher is a background dispatcher, the suggestion is to

wrap this inside of an |async_patterns::TestDispatcherBound|.

The driver registration's initialize and destroy hooks are executed from the context of the

dispatcher that this object lives on, therefore the driver's initial dispatcher will be this

same dispatcher.

Public Methods

void DriverUnderTest<Driver> (DriverRegistration driver_registration_symbol)

Defined at line 103 of file ../../sdk/lib/driver/testing/cpp/internal/driver_lifecycle.h

Driver * operator-> ()

Defined at line 107 of file ../../sdk/lib/driver/testing/cpp/internal/driver_lifecycle.h

Driver * operator* ()

Defined at line 108 of file ../../sdk/lib/driver/testing/cpp/internal/driver_lifecycle.h