class MockSvcDirectory

Defined at line 102 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/mock-debugdata.h

This implements a fake directory meant to be used as /svc for a test.

Arbitrary protocol endpoints can be added to it.

Example use:

```

auto mock = std::make_unique

<ld

::testing::MockDebugdata>();

EXPECT_CALL(*mock, "data-sink", ObjNameMatches("vmo-name"), _);

ld::testing::MockSvcDirectory svc_dir;

svc_dir.Init();

svc_dir.AddEntry

<fuchsia

_debugdata::Publisher>(std::move(mock));

... // Send pipelined Open containing Publish message, etc.

svc_dir.loop().RunUntilIdle(); // Drain messages just sent.

... // On destruction the mock will check it got the expected Publish.

```

Public Methods

void MockSvcDirectory ()

Defined at line 49 of file ../../sdk/lib/ld/testing/mock-debugdata.cc

void MockSvcDirectory (MockSvcDirectory && )

Defined at line 51 of file ../../sdk/lib/ld/testing/mock-debugdata.cc

void ~MockSvcDirectory ()

Defined at line 53 of file ../../sdk/lib/ld/testing/mock-debugdata.cc

void Init ()

This must be called first and gets gtest assertion failures for errors.

Defined at line 55 of file ../../sdk/lib/ld/testing/mock-debugdata.cc

async::Loop & loop ()

This must be run to drain messages at some point.

Defined at line 78 of file ../../sdk/lib/ld/testing/mock-debugdata.cc

void Serve (fidl::ServerEnd<fuchsia_io::Directory> server_end)

This consumes the server end, serving the mock directory FIDL protocol.

Defined at line 66 of file ../../sdk/lib/ld/testing/mock-debugdata.cc

void Serve (fidl::ClientEnd<fuchsia_io::Directory> & client_end)

This mints a fresh client end to the mock directory FIDL protocol.

Defined at line 71 of file ../../sdk/lib/ld/testing/mock-debugdata.cc

template <class Protocol, typename ServerImplPtr>
void AddEntry (ServerImplPtr && server_impl)

The explicit template parameter is some FIDL protocol bindings class.

The callable argument is passed to fidl::BindServer.

Defined at line 117 of file ../../sdk/lib/ld/testing/include/lib/ld/testing/mock-debugdata.h