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

Unified Diff: components/exo/display_unittest.cc

Issue 2452523002: exo: Add zcr_linux_explicit_synchronization_v1
Patch Set: 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
« no previous file with comments | « components/exo/display.cc ('k') | components/exo/surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/display_unittest.cc
diff --git a/components/exo/display_unittest.cc b/components/exo/display_unittest.cc
index a27d0d6398ced5bc7f690d9e4edf4554f5cf8917..675e21f3f4536042583f1e434e7ff23c38d60e30 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]);
+ ASSERT_TRUE(fence1);
+ 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)));
+
+ // Check that invalid file descriptors are rejected.
+ std::unique_ptr<gfx::GpuFence> fence2 = display->CreateLinuxFence(-1);
+ EXPECT_FALSE(fence2);
+}
+
// TODO(dcastagna): Add YV12 unittest once we can allocate the buffer
// via Ozone. crbug.com/618516
« no previous file with comments | « components/exo/display.cc ('k') | components/exo/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698