template <typename Configuration>
class DriverTestCommon
Defined at line 65 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
Public Methods
void DriverTestCommon<Configuration> ()
Defined at line 70 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
void ~DriverTestCommon<Configuration> ()
Defined at line 74 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
fdf_testing::DriverRuntime & runtime ()
Access the driver runtime object. This can be used to create new background dispatchers
or to run the foreground dispatcher.
Defined at line 78 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
template <typename ServiceMember, typename = std::enable_if_t<fidl::IsServiceMemberV<ServiceMember>>>
zx::result<fidl::internal::ClientEndType<typename ServiceMember::ProtocolType>> Connect (std::string_view instance)
Connects to a service member that the driver under test provides.
Defined at line 83 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
template <typename T>
T RunInEnvironmentTypeContext (fit::callback<T (EnvironmentType &)> task)
Runs a task on the dispatcher context of the EnvironmentType. This will be a different thread
than the main test thread, so be careful when capturing and returning pointers to objects that
live on different dispatchers like test fixture properties, or the driver.
Returns the result of the given task once it has completed.
Defined at line 103 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
void RunInEnvironmentTypeContext (fit::callback<void (EnvironmentType &)> task)
Runs a task on the dispatcher context of the EnvironmentType. This will be a different thread
than the main test thread, so be careful when capturing and returning pointers to objects that
live on different dispatchers like test fixture properties, or the driver.
Returns when the given task has completed.
Defined at line 115 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
template <typename T>
T RunInNodeContext (fit::callback<T (fdf_testing::TestNode &)> task)
Runs a task on the dispatcher context of the TestNode. This will be a different thread than
the main test thread, so be careful when capturing and returning pointers to objects that live
on different dispatchers like test fixture properties, or the driver.
Returns the result of the given task once it has completed.
Defined at line 128 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
void RunInNodeContext (fit::callback<void (fdf_testing::TestNode &)> task)
Runs a task on the dispatcher context of the TestNode. This will be a different thread than
the main test thread, so be careful when capturing and returning pointers to objects that live
on different dispatchers like test fixture properties, or the driver.
Returns when the given task has completed.
Defined at line 140 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
template <typename ProtocolType, typename = std::enable_if_t<fidl::IsProtocolV<ProtocolType>>>
zx::result<fidl::ClientEnd<ProtocolType>> ConnectThroughDevfs (std::string_view devfs_node_name)
Connect to a zircon transport based protocol through a devfs node that the driver under test
exports. The |devfs_node_name| is the name of the created node with the 'devfs_args'. This
node must have been created through the driver's immediate node. If the devfs node is nested,
use the variant that takes a vector of strings.
Defined at line 152 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
template <typename ProtocolType, typename = std::enable_if_t<fidl::IsProtocolV<ProtocolType>>>
zx::result<fidl::ClientEnd<ProtocolType>> ConnectThroughDevfs (std::vector<std::string> devfs_node_name_path)
Connect to a zircon transport based protocol through a devfs node that the driver under test
exports. The |devfs_node_name_path| is a list of node names that should be traversed to reach
the devfs node. The last element in the vector is the name of the created node with the
'devfs_args'.
Defined at line 161 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
zx::result<> StartDriver ()
Start the driver.
Defined at line 181 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
zx::result<> StartDriverWithCustomStartArgs (fit::callback<void (fdf::DriverStartArgs &)> args_modifier)
Start the driver with modified DriverStartArgs. This is done through the |args_modifier|
which is called with a reference to the start args that will be used to start the driver.
Modifications can happen in-place with this reference.
Defined at line 200 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
zx::result<> StopDriver ()
Stops the driver by calling the driver's PrepareStop hook and waiting for it to complete.
Defined at line 219 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
void ShutdownAndDestroyDriver ()
Shuts down the driver dispatchers fully, and then calls the driver's destroy hook.
Can be called multiple times, but it will only do the required work the first time.
If the driver running was started successfully, this must be called after |StopDriver|.
Defined at line 239 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
fidl::ClientEnd<fuchsia_io::Directory> ConnectToDriverSvcDir ()
Defined at line 258 of file ../../sdk/lib/driver/testing/cpp/driver_test.h
void SetServiceValidator (bool enable)
This will enable the service instance validation on the driver. Equivalent to setting
`service_connect_validation: "true"` in the cml of the driver.
This must be called before |StartDriver|/|StartDriverWithCustomStartArgs| as it will only
take affect on the next start of the driver and cannot modify an already started driver.
Defined at line 273 of file ../../sdk/lib/driver/testing/cpp/driver_test.h