Add RunFor to SimulatedEventLoopFactory
Turns out we really want to be able to run for short periods of time in
simulation. So add support and tests for it.
Change-Id: I9276e1330a0d4eaea717f949516b290b1a01ed89
diff --git a/aos/events/event-loop_param_test.h b/aos/events/event-loop_param_test.h
index a4e4b8e..b5574ba 100644
--- a/aos/events/event-loop_param_test.h
+++ b/aos/events/event-loop_param_test.h
@@ -13,7 +13,14 @@
public:
virtual ~EventLoopTestFactory() {}
+ // Makes a connected event loop.
virtual std::unique_ptr<EventLoop> Make() = 0;
+ // Makes a primary event loop. This is the one the tests will try to use for
+ // anything blocking.
+ virtual std::unique_ptr<EventLoop> MakePrimary() = 0;
+
+ // Runs the loops until they quit.
+ virtual void Run() = 0;
};
class AbstractEventLoopTest
@@ -21,12 +28,15 @@
public:
AbstractEventLoopTest() { factory_.reset(GetParam()()); }
- std::unique_ptr<EventLoop> Make() { return factory_->Make(); }
+ ::std::unique_ptr<EventLoop> Make() { return factory_->Make(); }
+ ::std::unique_ptr<EventLoop> MakePrimary() { return factory_->MakePrimary(); }
+
+ void Run() { return factory_->Run(); }
// You can implement all the usual fixture class members here.
// To access the test parameter, call GetParam() from class
// TestWithParam<T>.
private:
- std::unique_ptr<EventLoopTestFactory> factory_;
+ ::std::unique_ptr<EventLoopTestFactory> factory_;
};
} // namespace testing