Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30fab9d1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix a flaky test in buffer_hub-test"

parents 43c64c3f 2d89e6b3
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -451,13 +451,19 @@ TEST_F(LibBufferHubTest, TestCreateConsumerWhenBufferReleased) {
  EXPECT_EQ(0, c1->AcquireAsync(&metadata, &invalid_fence));
  EXPECT_EQ(0, c1->ReleaseAsync(&metadata, invalid_fence));

  // Note that the next PDX call is on the producer channel, which may be
  // executed before Release impulse gets executed by bufferhubd. Thus, here we
  // need to wait until the releasd is confirmed before creating another
  // consumer.
  EXPECT_LT(0, RETRY_EINTR(p->Poll(kPollTimeoutMs)));
  EXPECT_TRUE(IsBufferReleased(p->buffer_state()));

  // Create another consumer immediately after the release, should not make the
  // buffer un-released. This is guaranteed by IPC execution order in bufferhubd.
  // buffer un-released.
  std::unique_ptr<BufferConsumer> c2 =
      BufferConsumer::Import(p->CreateConsumer());
  ASSERT_TRUE(c2.get() != nullptr);

  EXPECT_LT(0, RETRY_EINTR(p->Poll(kPollTimeoutMs)));
  EXPECT_TRUE(IsBufferReleased(p->buffer_state()));
  EXPECT_EQ(0, p->GainAsync(&metadata, &invalid_fence));
  EXPECT_TRUE(IsBufferGained(p->buffer_state()));