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

Side by Side 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: addressed comment, add tests 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_AURA_TEST_EVENT_GENERATOR_H_
6 #define UI_AURA_TEST_EVENT_GENERATOR_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "ui/gfx/point.h"
11
12 namespace aura {
13 class Event;
14
15 namespace test {
16
17 // EventGenerator is a tool that generates and dispatch events for
18 // various mouse operations.
Ben Goodger (Google) 2011/10/15 05:36:30 EventGenerator is a tool that generates and dispat
oshima 2011/10/15 17:47:06 Done.
19 // TODO(oshima): Support key event
Ben Goodger (Google) 2011/10/15 05:36:30 events.
oshima 2011/10/15 17:47:06 Done.
20 class EventGenerator {
21 public:
22 EventGenerator();
23 EventGenerator(const gfx::Point& initial_location);
Ben Goodger (Google) 2011/10/15 05:36:30 explicit
24 virtual ~EventGenerator();
25
26 // Generates a left button press event.
27 void PressLeftButton();
28
29 // Generates a left button release event.
30 void ReleaseLeftButton();
31
32 // Generates events to click left button.
Ben Goodger (Google) 2011/10/15 05:36:30 click (press, release)
oshima 2011/10/15 17:47:06 Done.
33 void ClickLeftButton();
34
35 // Generates events to move mouse to given |point|.
Ben Goodger (Google) 2011/10/15 05:36:30 to the
oshima 2011/10/15 17:47:06 Done.
36 void MoveMouseTo(const gfx::Point& point);
37
38 void MoveMouseTo(int x, int y) {
39 MoveMouseTo(gfx::Point(x, y));
40 }
41
42 void MoveMouseBy(int x, int y) {
Ben Goodger (Google) 2011/10/15 05:36:30 int dx, int dy
oshima 2011/10/15 17:47:06 Done.
43 MoveMouseTo(current_.Add(gfx::Point(x, y)));
44 }
45
46 // Generates events to drag mouse to given |point|.
47 void DragMouseTo(const gfx::Point& point);
48
49 void DragMouseTo(int x, int y) {
50 DragMouseTo(gfx::Point(x, y));
51 }
52
53 void DragMouseBy(int x, int y) {
54 MoveMouseTo(current_.Add(gfx::Point(x, y)));
55 }
56
57 private:
58 // Dispatch the |event| to desktop.
Ben Goodger (Google) 2011/10/15 05:36:30 Dispatch |event| to the Desktop.
59 void Dispatch(const Event& event);
60
61 int flags_;
62 gfx::Point current_;
63 };
64
65 } // namespace test
66 } // namespace aura
67
68 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698