namespace testing

Namespaces

Functions

ReadAllChildNames

fpromise::promise<std::vector<std::string>> ReadAllChildNames(TreeNameIteratorClient & iter)

Defined at line 87 of file ../../sdk/lib/inspect/component/cpp/testing.cc

Collect all of the names of the children of the `Inspector` managed by the tree server which started the TreeNameIterator server. Essentially, it drains the iterator.

ReadFromTree

fpromise::promise<Hierarchy> ReadFromTree(TreeClient & tree, async_dispatcher_t * dispatcher)

Defined at line 120 of file ../../sdk/lib/inspect/component/cpp/testing.cc

Turn a Tree handle into a complete hierarchy, including lazy children/values.

This function uses `ZX_ASSERT` if it encounters FIDL errors.

NameMatches

Matcher NameMatches( basic_string name)

Defined at line 104 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches against the name of an Inspect Node. Example: EXPECT_THAT(node, NameMatches("objects"));

PropertyList

Matcher PropertyList( Matcher matcher)

Defined at line 108 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches against the property list of an Inspect Node. Example: EXPECT_THAT(node, AllOf(PropertyList(::testing::IsEmpty())));

StringIs

Matcher StringIs(const std::string & name, Matcher matcher)

Defined at line 112 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches a particular StringProperty with the given name using the given matcher.

ByteVectorIs

Matcher ByteVectorIs(const std::string & name, ::testing::Matcher<std::vector<uint8_t>> matcher)

Defined at line 121 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches a particular ByteVectorProperty with the given name using the given matcher.

IntIs

Matcher IntIs(const std::string & name, ::testing::Matcher<int64_t> matcher)

Defined at line 130 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches a particular IntProperty with the given name using the given matcher.

ComputeLinearBucketIndex

size_t ComputeLinearBucketIndex(T floor, T step_size, size_t total_buckets, T value)

Defined at line 138 of file ../../sdk/lib/inspect/testing/cpp/inspect.h

Computes the bucket index for a value in a linear histogram. |total_buckets| is the number of buckets initially defined when the histogram property was created plus 2 (overflow and underflow).

UintIs

Matcher UintIs(const std::string & name, Matcher matcher)

Defined at line 139 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches a particular UintProperty with the given name using the given matcher.

DoubleIs

Matcher DoubleIs(const std::string & name, ::testing::Matcher<double> matcher)

Defined at line 148 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches a particular DoubleProperty with the given name using the given matcher.

ComputeExponentialBucketIndex

size_t ComputeExponentialBucketIndex(T floor, T initial_step, T step_multiplier, size_t total_buckets, T value)

Defined at line 151 of file ../../sdk/lib/inspect/testing/cpp/inspect.h

Computes the bucket index for a value in an exponential histogram. |total_buckets| is the number of buckets initially defined when the histogram property was created plus 2 (overflow and underflow).

BoolIs

Matcher BoolIs(const std::string & name, ::testing::Matcher<bool> matcher)

Defined at line 157 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches a particular BoolProperty with the given name using the given matcher.

IntArrayIs

Matcher IntArrayIs(const std::string & name, ::testing::Matcher<std::vector<int64_t>> )

Defined at line 166 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches the values of an integer array.

CreateExpectedLinearHistogramContents

std::vector<T> CreateExpectedLinearHistogramContents(T floor, T step_size, size_t buckets, const std::vector<T> & values)

Defined at line 167 of file ../../sdk/lib/inspect/testing/cpp/inspect.h

Creates the expected contents of a linear histogram given parameters and values.

UintArrayIs

Matcher UintArrayIs(const std::string & name, ::testing::Matcher<std::vector<uint64_t>> )

Defined at line 175 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches the values of an unsigned integer array.

DoubleArrayIs

Matcher DoubleArrayIs(const std::string & name, ::testing::Matcher<std::vector<double>> )

Defined at line 184 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches the values of a double width floating point number array.

CreateExpectedExponentialHistogramContents

std::vector<T> CreateExpectedExponentialHistogramContents(T floor, T initial_step, T step_multiplier, size_t buckets, const std::vector<T> & values)

Defined at line 186 of file ../../sdk/lib/inspect/testing/cpp/inspect.h

Creates the expected contents of an exponential histogram given parameters and values.

ArrayDisplayFormatIs

Matcher ArrayDisplayFormatIs( ArrayDisplayFormat format)

Defined at line 193 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matches the display format of a numeric array value.

NodeMatches

Matcher NodeMatches( Matcher matcher)

Defined at line 209 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matcher for the object inside an Hierarchy.

ObjectMatches

Matcher ObjectMatches( Matcher matcher)

Defined at line 213 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

DEPRECATED: Compatibility for downstream clients. TODO(https://fxbug.dev/42122386): Remove this.

PrefixPathMatches

Matcher PrefixPathMatches( Matcher matcher)

Matcher for the base path inside an Hierarchy.

ChildrenMatch

Matcher ChildrenMatch( Matcher matcher)

Defined at line 217 of file ../../sdk/lib/inspect/testing/cpp/inspect.cc

Matcher for the children of the object in an Hierarchy.