summaryrefslogtreecommitdiffstats
path: root/tools/xdisplaycheck
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 01:25:54 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 01:25:54 +0000
commit4c92127a3884bd315dd2d92fd0f63a7aa6f66826 (patch)
treebdddd94ae344d1c5466046f68fff184c62be228b /tools/xdisplaycheck
parentdc62ba68e1a0d6c093d768b700d57ce3e517fab3 (diff)
downloadchromium_src-4c92127a3884bd315dd2d92fd0f63a7aa6f66826.zip
chromium_src-4c92127a3884bd315dd2d92fd0f63a7aa6f66826.tar.gz
chromium_src-4c92127a3884bd315dd2d92fd0f63a7aa6f66826.tar.bz2
Check for XInput2 for touchui and aura bots.
BUG=101061 TEST=none Review URL: http://codereview.chromium.org/8363012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106652 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/xdisplaycheck')
-rw-r--r--tools/xdisplaycheck/xdisplaycheck.cc42
1 files changed, 37 insertions, 5 deletions
diff --git a/tools/xdisplaycheck/xdisplaycheck.cc b/tools/xdisplaycheck/xdisplaycheck.cc
index b7a9754..510f6e0 100644
--- a/tools/xdisplaycheck/xdisplaycheck.cc
+++ b/tools/xdisplaycheck/xdisplaycheck.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -15,6 +15,10 @@
#include <time.h>
#include <X11/Xlib.h>
+#if defined(TOUCH_UI) || defined(USE_AURA)
+#include <X11/extensions/XInput2.h>
+#endif
+
void Sleep(int duration_ms) {
struct timespec sleep_time, remaining;
@@ -31,13 +35,41 @@ void Sleep(int duration_ms) {
int main(int argc, char* argv[]) {
int kNumTries = 50;
+ Display* display = NULL;
for (int i = 0; i < kNumTries; ++i) {
- Display* display = XOpenDisplay(NULL);
+ display = XOpenDisplay(NULL);
if (display)
- return 0;
+ break;
Sleep(100);
}
- printf("Failed to connect to %s\n", XDisplayName(NULL));
- return -1;
+ if (!display) {
+ fprintf(stderr, "Failed to connect to %s\n", XDisplayName(NULL));
+ return -1;
+ }
+
+#if defined(TOUCH_UI) || defined(USE_AURA)
+ // Check for XInput2
+ int opcode, event, err;
+ if (!XQueryExtension(display, "XInputExtension", &opcode, &event, &err)) {
+ fprintf(stderr,
+ "Failed to get XInputExtension on %s.\n", XDisplayName(NULL));
+ return -1;
+ }
+
+ int major = 2, minor = 0;
+ if (XIQueryVersion(display, &major, &minor) == BadRequest) {
+ fprintf(stderr,
+ "Server does not have XInput2 on %s.\n", XDisplayName(NULL));
+ return -1;
+ }
+
+ // Ask for the list of devices. This can cause some Xvfb to crash.
+ int count = 0;
+ XIDeviceInfo* devices = XIQueryDevice(display, XIAllDevices, &count);
+ if (devices)
+ XIFreeDeviceInfo(devices);
+#endif
+
+ return 0;
}