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

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

Issue 264713007: Add unittests for X11TopmostWindowFinder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/gfx/path_x11.cc ('k') | ui/views/test/x11_property_change_waiter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/x11_property_change_waiter.h
diff --git a/ui/views/test/x11_property_change_waiter.h b/ui/views/test/x11_property_change_waiter.h
new file mode 100644
index 0000000000000000000000000000000000000000..94f5c07db361397adda7aa3821476f56ad110d47
--- /dev/null
+++ b/ui/views/test/x11_property_change_waiter.h
@@ -0,0 +1,64 @@
+// Copyright 2014 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_X11_PROPERTY_CHANGE_WAITER_H_
+#define UI_VIEWS_TEST_X11_PROPERTY_CHANGE_WAITER_H_
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/events/platform/platform_event_dispatcher.h"
+#include "ui/events/platform/platform_event_types.h"
+#include "ui/gfx/x/x11_types.h"
+
+namespace ui {
+class ScopedEventDispatcher;
+class X11AtomCache;
+}
+
+namespace views {
+
+// Blocks till the value of |property| on |window| changes.
+class X11PropertyChangeWaiter : public ui::PlatformEventDispatcher {
+ public:
+ X11PropertyChangeWaiter(XID window, const char* property);
+ virtual ~X11PropertyChangeWaiter();
+
+ // Blocks till the value of |property_| changes.
+ void Wait();
+
+ protected:
+ // Returns whether the run loop can exit.
sadrul 2014/05/27 15:17:18 Mention here that |event| can be NULL, and explain
+ virtual bool ShouldKeepOnWaiting(const ui::PlatformEvent& event);
+
+ XID xwindow() const {
+ return x_window_;
+ }
+
+ private:
+ // ui::PlatformEventDispatcher:
+ virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE;
+ virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE;
+
+ XID x_window_;
+ const char* property_;
+
+ // Whether Wait() should block.
+ bool wait_;
+
+ // Ends the run loop.
+ base::Closure quit_closure_;
+
+ // The event mask to be restored upon PropertyChangeWaiter's destruction.
+ long old_event_mask_;
+
+ scoped_ptr<ui::ScopedEventDispatcher> dispatcher_;
+
+ scoped_ptr<ui::X11AtomCache> atom_cache_;
+
+ DISALLOW_COPY_AND_ASSIGN(X11PropertyChangeWaiter);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_TEST_X11_PROPERTY_CHANGE_WAITER_H_
« no previous file with comments | « ui/gfx/path_x11.cc ('k') | ui/views/test/x11_property_change_waiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698