blob: a4e4b8ed3ec897f3ede7e6d0aba6f8f5435ac6e2 [file] [log] [blame]
Parker Schuhe4a70d62017-12-27 20:10:20 -08001#ifndef _AOS_EVENTS_EVENT_LOOP_PARAM_TEST_H_
2#define _AOS_EVENTS_EVENT_LOOP_PARAM_TEST_H_
3
Neil Balch229001a2018-01-07 18:22:52 -08004#include <vector>
5
Parker Schuhe4a70d62017-12-27 20:10:20 -08006#include "aos/events/event-loop.h"
7#include "gtest/gtest.h"
8
9namespace aos {
10namespace testing {
11
12class EventLoopTestFactory {
13 public:
14 virtual ~EventLoopTestFactory() {}
15
16 virtual std::unique_ptr<EventLoop> Make() = 0;
17};
18
19class AbstractEventLoopTest
20 : public ::testing::TestWithParam<std::function<EventLoopTestFactory *()>> {
21 public:
22 AbstractEventLoopTest() { factory_.reset(GetParam()()); }
23
24 std::unique_ptr<EventLoop> Make() { return factory_->Make(); }
25 // You can implement all the usual fixture class members here.
26 // To access the test parameter, call GetParam() from class
27 // TestWithParam<T>.
28 private:
29 std::unique_ptr<EventLoopTestFactory> factory_;
30};
31
32} // namespace testing
33} // namespace aos
34
35#endif // _AOS_EVENTS_EVENT_LOOP_PARAM_TEST_H_