32TEST(PipelineCompileQueueTest, AddJobReturnsTrueForNewDescriptor) {
35 bool job_executed =
false;
36 fml::closure job = [&job_executed]() { job_executed =
true; };
38 bool result =
queue.AddJobForTest(desc, job);
42TEST(PipelineCompileQueueTest, AddJobReturnsFalseForDuplicateDescriptor) {
45 bool job1_executed =
false;
46 bool job2_executed =
false;
47 fml::closure job1 = [&job1_executed]() { job1_executed =
true; };
48 fml::closure job2 = [&job2_executed]() { job2_executed =
true; };
50 bool result1 =
queue.AddJobForTest(desc, job1);
51 bool result2 =
queue.AddJobForTest(desc, job2);
54 EXPECT_FALSE(result2);
57TEST(PipelineCompileQueueTest, HasPendingJobsReturnsCorrectState) {
62 EXPECT_FALSE(
queue.HasPendingJobsForTest());
64 queue.AddJobForTest(desc, job);
65 EXPECT_TRUE(
queue.HasPendingJobsForTest());
68TEST(PipelineCompileQueueTest, PerformJobEagerlyExecutesJob) {
71 bool job_executed =
false;
72 fml::closure job = [&job_executed]() { job_executed =
true; };
74 queue.AddJobForTest(desc, job);
75 queue.PerformJobEagerly(desc);
77 EXPECT_TRUE(job_executed);
78 EXPECT_FALSE(
queue.HasPendingJobsForTest());
81TEST(PipelineCompileQueueTest, FinishAllJobsDrainsQueue) {
82 auto queue = std::make_shared<TestPipelineCompileQueue>();
84 bool job_executed =
false;
85 fml::closure job = [&job_executed]() { job_executed =
true; };
87 queue->AddJobForTest(desc, job);
88 EXPECT_TRUE(
queue->HasPendingJobsForTest());
92 EXPECT_TRUE(job_executed);
A task queue designed for managing compilation of pipeline state objects.
bool AddJob(const PipelineDescriptor &desc, const fml::closure &job)
Add a compilation job to the pending queue for the specified descriptor.
bool HasPendingJobs()
Check if there are any pending compilation jobs in the queue.
bool HasPendingJobsForTest()
bool AddJobForTest(const PipelineDescriptor &desc, const fml::closure &job)
void OnJobAdded() override
Called by PostJobForDescriptor after a job has been successfully added to the queue....
void PostJob(const fml::closure &job) override
Post a compilation job to the worker task runner.
TEST(FrameTimingsRecorderTest, RecordVsync)
std::function< void()> closure