tree: 86fa54e4a7b289915ad13f8b0c510932fa89e3b3 [path history] [tgz]
  1. include/
  2. BUILD.gn
  3. README.md
  4. real_loop_fixture.cc
  5. real_loop_fixture_unittest.cc
  6. test_loop_fixture.cc
  7. test_loop_fixture_unittest.cc
third_party/googletest/loop_fixture/README.md

Test loop fixture

If you have code that runs using the async-cpp library, you can use this test loop fixture to drive your code.

The canonical source for this library is the Fuchsia source tree at //src/lib/testing/loop_fixture.

Using the loop fixture

Add the loop fixture as a dependency of your test.

import("//third_party/googletest/loop_fixture")

Add the following to your test code:

  • The include statement.
  • A subclass of TestLoopFixture.
  • A call to run the loop.
#include <third_party/googletest/loop_fixture/test_loop_fixture.h>

// The fixture for testing the Engine class.
class EngineDeviceUnitTest : public gtest::TestLoopFixture {
 public:
  void SetUp() override {
    TestLoopFixture::SetUp();
    // Other setup.
  }

  void TearDown() override {
    // Other teardown.
    TestLoopFixture::TearDown();
  }
}

TEST_F(EngineDeviceUnitTest, Negation) {
  // Call function under test.

  RunLoopUntilIdle();

  // Do verifications.
}