| 55 | } |
| 56 | |
| 57 | TEST(dds_DCPS_SporadicTask, schedule) |
| 58 | { |
| 59 | MyTimeSource time_source; |
| 60 | MyReactor* reactor = new MyReactor; |
| 61 | ThreadStatusManager tsm; |
| 62 | ReactorTask reactor_task(false); |
| 63 | reactor_task.open_reactor_task(&tsm, "test", reactor); |
| 64 | RcHandle<MySporadicTask> sporadic_task = make_rch<MySporadicTask>(time_source, rchandle_from(&reactor_task)); |
| 65 | const TimeDuration one_second(1); |
| 66 | const ACE_Time_Value now(7); |
| 67 | |
| 68 | EXPECT_CALL(time_source, monotonic_time_point_now()) |
| 69 | .Times(1) |
| 70 | .WillOnce(testing::Return(MonotonicTimePoint::zero_value)); |
| 71 | EXPECT_CALL(*reactor, schedule_timer(sporadic_task.get(), 0, one_second.value(), ACE_Time_Value::zero)) |
| 72 | .Times(1) |
| 73 | .WillOnce(testing::Return(1)); |
| 74 | EXPECT_CALL(*sporadic_task.get(), execute(MonotonicTimePoint(now))); |
| 75 | |
| 76 | sporadic_task->schedule(one_second); |
| 77 | reactor_task.wait_until_empty(); |
| 78 | |
| 79 | // Execute. |
| 80 | RcHandle<RcEventHandler> eh = sporadic_task; |
| 81 | eh->handle_timeout(now); |
| 82 | |
| 83 | reactor_task.stop(); |
| 84 | } |
| 85 | |
| 86 | TEST(dds_DCPS_SporadicTask, schedule_pmf) |
| 87 | { |
nothing calls this directly
no test coverage detected