class RealLoopFixture
Defined at line 45 of file ../../src/lib/testing/loop_fixture/real_loop_fixture.h
An extension of Test class which sets up a message loop,
async::Loop, for the test. This fixture is meant to be used for
multi-process tests.
This allows, for example, a test to conveniently exercise FIDL, as FIDL
bindings post waits to the thread-local dispatcher.
Example:
#include "foo.fidl.h"
class TestFoo : public Foo {
public:
explicit TestFoo(InterfaceRequest
<Foo
> request)
: binding_(this, std::move(request) {}
// Foo implementation here.
private:
Binding
<Foo
> binding_;
};
// Creates a fixture that creates a message loop on this thread.
class TestBar : public ::gtest::RealLoopFixture { /* ... */ };
TEST_F(TestBar, TestCase) {
// Do all FIDL-y stuff here and asynchronously quit.
RunLoop();
// Check results from FIDL-y stuff here.
}