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

Unified Diff: tools/xdisplaycheck/xdisplaycheck.cc

Issue 8363012: Check for XInput2 for touchui and aura bots. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/xdisplaycheck/xdisplaycheck.cc
diff --git a/tools/xdisplaycheck/xdisplaycheck.cc b/tools/xdisplaycheck/xdisplaycheck.cc
index b7a975426684b25df39071534941a0f10f17601b..510f6e078ee998c72bd0f95f4725d9d28b00a2eb 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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698