Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5150)

Unified Diff: components/exo/display_unittest.cc

Issue 2404513002: exo: Implement zcr_linux_explicit_synchronization_v1
Patch Set: rebase, address review comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/exo/display_unittest.cc
diff --git a/components/exo/display_unittest.cc b/components/exo/display_unittest.cc
index 694915dbf624be1dba91dbfc994756c9c6810081..ac29c755f917bca935f6b892c574f9999519d71b 100644
--- a/components/exo/display_unittest.cc
+++ b/components/exo/display_unittest.cc
@@ -86,6 +86,35 @@ TEST_F(DisplayTest, DISABLED_CreateLinuxDMABufBuffer) {
EXPECT_FALSE(buffer2);
}
+TEST_F(DisplayTest, CreateLinuxFence) {
+ int sockets_unscoped[2];
+
+ ASSERT_EQ(0, socketpair(AF_UNIX, SOCK_STREAM, 0, fds));
+
+ // Emulate the behaviour of a fence FD (returns POLLIN when signaled) using
+ // a socket pair.
+ Base::ScopedFD socket_waitee(sockets_unscoped[0]);
+
+ std::unique_ptr<gfx::GpuFence> fence1 =
+ display->CreateLinuxFence(sockets_unscoped[1]);
+ EXPECT_TRUE(fence1);
reveman 2016/10/12 19:20:19 nit: ASSERT_TRUE as code below will crash if this
+ close(sockets_unscoped[1]);
+
+ // The fence must be unsignaled when we start.
+ EXPECT_FALSE(fence1->Wait(TimeDelta::FromMilliseconds(50)));
+
+ // Unblock the fence, and make sure this signals success.
+ uint32_t dummy = 1;
+ ASSERT_EQ(sizeof(dummy), UnixDomainSocket::SendMsg(socket_waitee, &dummy,
+ sizeof(dummy), nullptr));
+
+ EXPECT_TRUE(fence1->Wait(TimeDelta::FromMilliseconds(50)));
+
+ std::unique_ptr<gfx::GpuFence> fence2 =
reveman 2016/10/12 19:20:19 nit: just a short comment here to explain that thi
+ display->CreateLinuxFence(-1);
+ EXPECT_FALSE(fence2);
+}
+
// TODO(dcastagna): Add YV12 unittest once we can allocate the buffer
// via Ozone. crbug.com/618516

Powered by Google App Engine
This is Rietveld 408576698