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

Unified Diff: ui/views/test/test_desktop_screen_x11.h

Issue 2327623002: X11: Add TestDesktopScreenX11 to simulate mouse movement in ui tests (Closed)
Patch Set: Move test_desktop_screen_x11 to test_support_internal Created 4 years, 3 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 | « ui/views/BUILD.gn ('k') | ui/views/test/test_desktop_screen_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/test_desktop_screen_x11.h
diff --git a/ui/views/test/test_desktop_screen_x11.h b/ui/views/test/test_desktop_screen_x11.h
new file mode 100644
index 0000000000000000000000000000000000000000..b84bb21eba7300f7d8a387149612cbfc780237be
--- /dev/null
+++ b/ui/views/test/test_desktop_screen_x11.h
@@ -0,0 +1,48 @@
+// Copyright 2016 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.
+
+#ifndef UI_VIEWS_TEST_TEST_DESKTOP_SCREEN_X11_H_
+#define UI_VIEWS_TEST_TEST_DESKTOP_SCREEN_X11_H_
+
+#include "ui/gfx/geometry/point.h"
+#include "ui/views/widget/desktop_aura/desktop_screen_x11.h"
+
+namespace base {
+template<typename T> struct DefaultSingletonTraits;
+}
+
+namespace views {
+namespace test {
+
+// Replaces the screen instance in Linux (non-ChromeOS) tests. Allows
+// aura tests to manually set the cursor screen point to be reported
+// by GetCursorScreenPoint(). Needed because of a limitation in the
+// X11 protocol that restricts us from warping the pointer with the
+// mouse button held down.
+class TestDesktopScreenX11 : public DesktopScreenX11 {
+ public:
+ static TestDesktopScreenX11* GetInstance();
+
+ TestDesktopScreenX11();
+ ~TestDesktopScreenX11() override;
+
+ // DesktopScreenX11:
+ gfx::Point GetCursorScreenPoint() override;
+
+ void set_cursor_screen_point(const gfx::Point& point) {
+ cursor_screen_point_ = point;
+ }
+
+ private:
+ friend struct base::DefaultSingletonTraits<TestDesktopScreenX11>;
+
+ gfx::Point cursor_screen_point_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestDesktopScreenX11);
+};
+
+} // namespace test
+} // namespace views
+
+#endif // UI_VIEWS_TEST_TEST_DESKTOP_SCREEN_X11_H_
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/test/test_desktop_screen_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698