summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2012-12-05 19:05:26 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2012-12-05 20:26:26 -0500
commiteed84d13e96a519445e6f692ee1b160912300cc9 (patch)
treeb037ca278c2d4f8e7ae703e77a6a3de4802adc3a
parent400e56e724fb45016720b4e51adb58e2d85bf364 (diff)
server/barriers: Add a test for multiple clients
Ensure that one client can't destroy another's barriers.
-rw-r--r--tests/server/barriers-validity.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/server/barriers-validity.cpp b/tests/server/barriers-validity.cpp
index 342830b..4019b07 100644
--- a/tests/server/barriers-validity.cpp
+++ b/tests/server/barriers-validity.cpp
@@ -48,6 +48,24 @@ TEST_F(BarrierSimpleTest, DestroyInvalidBarrier)
ASSERT_ERROR(error, xfixes_error_base + BadBarrier);
}
+TEST_F(BarrierSimpleTest, MultipleClientSecurity)
+{
+ XORG_TESTCASE("Ensure that two clients can't delete"
+ " each other's barriers.\n");
+
+ ::Display *dpy1 = XOpenDisplay(server.GetDisplayString().c_str());
+ ::Display *dpy2 = XOpenDisplay(server.GetDisplayString().c_str());
+ Window root = DefaultRootWindow(dpy1);
+
+ PointerBarrier barrier = XFixesCreatePointerBarrier(dpy1, root, 20, 20, 20, 40, 0, 0, NULL);
+ XSync(dpy1, False);
+
+ SetErrorTrap(dpy2);
+ XFixesDestroyPointerBarrier(dpy2, barrier);
+ const XErrorEvent *error = ReleaseErrorTrap(dpy2);
+ ASSERT_ERROR(error, BadAccess);
+}
+
TEST_F(BarrierSimpleTest, PixmapsNotAllowed)
{
XORG_TESTCASE("Pixmaps are not allowed as drawable.\n"