template <typename Configuration>

class ForegroundDriverTest

Defined at line 398 of file ../../sdk/lib/driver/testing/cpp/driver_test.h

Foreground driver tests have the driver-under-test executing on the foreground (main) test

thread. This allows for the test to directly reach into the driver to call methods on it.

This is good for unit tests that more heavily test a driver through its public methods,

rather than its exposed FIDL services.

The test can access the driver under test using the |driver()| method and directly make calls

into it, but sync client tasks must go through |RunOnBackgroundDispatcherSync()|.

Public Methods

void ~ForegroundDriverTest<Configuration> ()

Defined at line 402 of file ../../sdk/lib/driver/testing/cpp/driver_test.h

template <typename T>
zx::result<T> RunOnBackgroundDispatcherSync (fit::callback<T ()> task)

Runs a task in a background context while running the foreground driver. This must be used

if calling synchronously into the driver (eg. a fidl call through a SyncClient).

Returns the result of the given task once it has completed.

Defined at line 409 of file ../../sdk/lib/driver/testing/cpp/driver_test.h

zx::result<> RunOnBackgroundDispatcherSync (fit::callback<void ()> task)

Runs a task in a background context while running the foreground driver. This must be used

if calling synchronously into the driver (eg. a fidl call through a SyncClient).

Returns when the given task has completed.

Defined at line 437 of file ../../sdk/lib/driver/testing/cpp/driver_test.h

DriverType * driver ()

Access the driver under test. Can only be called while the driver is active, after

|StartDriver| has been called, but before |ShutdownAndDestroyDriver|.

Defined at line 462 of file ../../sdk/lib/driver/testing/cpp/driver_test.h