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)));
}
Public Methods
void ReadInspect (const zx::vmo & vmo)
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.
Defined at line 14 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.cc
void ReadInspect (const inspect::Inspector & inspector)
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.
Defined at line 19 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.cc
void PrintAllProperties (const inspect::NodeValue & node, unsigned int indent)
Printers for debugging purpose.
Defined at line 29 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.cc
void InspectTestHelper ()
Defined at line 36 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.h
inspect::Hierarchy & hierarchy ()
Defined at line 51 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.h
template <typename T>
void CheckProperty (const inspect::NodeValue & node, std::string property, T expected_value)
Defined at line 54 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.h
void PrintAllProperties (const inspect::Hierarchy & hierarchy)
Defined at line 99 of file ../../sdk/lib/inspect/testing/cpp/zxtest/inspect.cc