| 37 | } |
| 38 | |
| 39 | TEST(CoordinatorTest, TestStopAndWaitOnStop) { |
| 40 | Coordinator coord; |
| 41 | EXPECT_EQ(coord.ShouldStop(), false); |
| 42 | |
| 43 | Notification about_to_wait; |
| 44 | Notification done; |
| 45 | Env::Default()->SchedClosure( |
| 46 | std::bind(&WaitForStopThread, &coord, &about_to_wait, &done)); |
| 47 | about_to_wait.WaitForNotification(); |
| 48 | Env::Default()->SleepForMicroseconds(1000 * 1000); |
| 49 | EXPECT_FALSE(done.HasBeenNotified()); |
| 50 | |
| 51 | TF_EXPECT_OK(coord.RequestStop()); |
| 52 | done.WaitForNotification(); |
| 53 | EXPECT_TRUE(coord.ShouldStop()); |
| 54 | } |
| 55 | |
| 56 | class MockQueueRunner : public RunnerInterface { |
| 57 | public: |
nothing calls this directly
no test coverage detected