class InspectTestHelper
Defined at line 34 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.h
Helper class to test inspect data with zxtest framework. Example:
using inspect::InspectTestHelper; class ExampleTest : inspect::InspectTestHelper, public zxtest::Test { public: zx::vmo& inspect_vmo() { // returns inspect vmo} inspect::Inspector& inspector() { // returns inspector reference } };
TEST_F(ExampleTest, CheckInspectVmo) { ASSERT_NO_FATAL_FAILURE(ReadInspect(inspect_vmo())); CheckProperty( hierarchy().node(), "root_property1", inspect::StringPropertyValue("OK"))); auto* genX_node = hierarchy().GetByPath({"child", "grandchild"}); ASSERT_TRUE(genX_node); CheckProperty( genX_node->node(), "genX_status", inspect::IntPropertyValue(ZX_OK))); }
Functions
ReadInspect
public void ReadInspect(const zx::vmo & vmo)
Defined at line 14 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.cc
Helper method to read from a VMO. Note: ReadInspect needs to be called everytime inspect data is changed for the changes to be reflected in the hierarchy.
ReadInspect
public void ReadInspect(const inspect::Inspector & inspector)
Defined at line 19 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.cc
Helper method to read from inspect::Inspector. Note: - ReadInspect needs to be called everytime inspect data is changed for the changes to be reflected in the hierarchy. - This method processes inspect tree on the calling thread. If the inspector has lazy nodes that rely on other dispatchers, this method should not be used.
PrintAllProperties
public void PrintAllProperties(const inspect::NodeValue & node, unsigned int indent)
Defined at line 29 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.cc
Printers for debugging purpose.
InspectTestHelper
public void InspectTestHelper()
Defined at line 36 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.h
hierarchy
public inspect::Hierarchy & hierarchy()
Defined at line 51 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.h
CheckProperty
public void CheckProperty(const inspect::NodeValue & node,
basic_string
property, T expected_value)
Defined at line 54 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.h
PrintAllProperties
public void PrintAllProperties(const inspect::Hierarchy & hierarchy)
Defined at line 99 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.cc