| 1008 | }; |
| 1009 | |
| 1010 | TEST_F(FutureSchedulingTest, ScheduleNever) { |
| 1011 | CallbackOptions options; |
| 1012 | options.should_schedule = ShouldSchedule::Never; |
| 1013 | options.executor = executor(); |
| 1014 | // Successful future |
| 1015 | { |
| 1016 | auto fut = Future<>::Make(); |
| 1017 | fut.AddCallback(callback(1), options); |
| 1018 | fut.MarkFinished(); |
| 1019 | fut.AddCallback(callback(2), options); |
| 1020 | ASSERT_EQ(0, spawn_count()); |
| 1021 | AssertRunSynchronously({1, 2}); |
| 1022 | } |
| 1023 | // Failing future |
| 1024 | { |
| 1025 | auto fut = Future<>::Make(); |
| 1026 | fut.AddCallback(callback(3), options); |
| 1027 | fut.MarkFinished(Status::Invalid("XYZ")); |
| 1028 | fut.AddCallback(callback(4), options); |
| 1029 | ASSERT_EQ(0, spawn_count()); |
| 1030 | AssertRunSynchronously({3, 4}); |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | TEST_F(FutureSchedulingTest, ScheduleAlways) { |
| 1035 | CallbackOptions options; |
nothing calls this directly
no test coverage detected