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

Unified Diff: ui/aura/test/event_generator.h

Issue 8273040: Minimum size for aura window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressd comment 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 | « ui/aura/aura.gyp ('k') | ui/aura/test/event_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/event_generator.h
diff --git a/ui/aura/test/event_generator.h b/ui/aura/test/event_generator.h
new file mode 100644
index 0000000000000000000000000000000000000000..afafd4ea5edad5de2fd3b8f57ab6ac6298c6474f
--- /dev/null
+++ b/ui/aura/test/event_generator.h
@@ -0,0 +1,82 @@
+// 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.
+
+#ifndef UI_AURA_TEST_EVENT_GENERATOR_H_
+#define UI_AURA_TEST_EVENT_GENERATOR_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "ui/gfx/point.h"
+
+namespace aura {
+class Event;
+class Window;
+
+namespace test {
+
+// EventGenerator is a tool that generates and dispatch events.
+// TODO(oshima): Support key events.
+class EventGenerator {
+ public:
+ // Creates an EventGenerator with the mouse location (0,0).
+ EventGenerator();
+
+ // Creates an EventGenerator with the mouse location at |initial_location|.
+ explicit EventGenerator(const gfx::Point& initial_location);
+
+ // Creates an EventGenerator with the mouse location centered over |window|.
+ explicit EventGenerator(Window* window);
+
+ virtual ~EventGenerator();
+
+ const gfx::Point& current_location() const { return current_location_; }
+
+ // Generates a left button press event.
+ void PressLeftButton();
+
+ // Generates a left button release event.
+ void ReleaseLeftButton();
+
+ // Generates events to click (press, release) left button.
+ void ClickLeftButton();
+
+ // Generates events to move mouse to be the given |point|.
+ void MoveMouseTo(const gfx::Point& point);
+
+ void MoveMouseTo(int x, int y) {
+ MoveMouseTo(gfx::Point(x, y));
+ }
+
+ void MoveMouseBy(int x, int y) {
+ MoveMouseTo(current_location_.Add(gfx::Point(x, y)));
+ }
+
+ // Generates events to drag mouse to given |point|.
+ void DragMouseTo(const gfx::Point& point);
+
+ void DragMouseTo(int x, int y) {
+ DragMouseTo(gfx::Point(x, y));
+ }
+
+ void DragMouseBy(int dx, int dy) {
+ DragMouseTo(current_location_.Add(gfx::Point(dx, dy)));
+ }
+
+ // Generates events to move the mouse to the center of the window.
+ void MoveMouseToCenterOf(Window* window);
+
+ private:
+ // Dispatch the |event| to the Desktop.
+ void Dispatch(const Event& event);
+
+ int flags_;
+ gfx::Point current_location_;
+
+ DISALLOW_COPY_AND_ASSIGN(EventGenerator);
+};
+
+} // namespace test
+} // namespace aura
+
+#endif // UI_AURA_TEST_EVENT_GENERATOR_H_
« no previous file with comments | « ui/aura/aura.gyp ('k') | ui/aura/test/event_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698