Skip to content

Commit

Permalink
Add ScheduleJobDuringShutdown test
Browse files Browse the repository at this point in the history
Adds test to check that proper handling of JobThread shutdown.
In current form this test should fail, because std::unique_ptr is
not suitable to hold JobThread.

b/372515171
  • Loading branch information
alexanderbobrovnik committed Feb 7, 2025
1 parent 7a22759 commit aae7fd6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions starboard/shared/starboard/player/job_thread_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ TEST(JobThreadTest, QueueBelongsToCorrectThread) {
EXPECT_TRUE(belongs_to_main_thread);
}

TEST(JobThreadTest, ScheduleJobDuringShutdown) {
std::unique_ptr<JobThread> job_thread_ptr(new JobThread{"JobThreadTests"});

bool job_thread_is_null = true;

job_thread_ptr->Schedule(
[&]() { job_thread_is_null = job_thread_ptr == nullptr; },
10 * kPrecisionUsec);

job_thread_ptr.reset();

EXPECT_FALSE(job_thread_is_null);
}

} // namespace
} // namespace player
} // namespace starboard
Expand Down

0 comments on commit aae7fd6

Please sign in to comment.