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

Side by Side Diff: ui/aura/test/event_generator.h

Issue 8576005: IME (input method editor) support for Aura, part 3 of 3: Use ui::InputMethod in ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fixes Created 9 years 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_AURA_TEST_EVENT_GENERATOR_H_ 5 #ifndef UI_AURA_TEST_EVENT_GENERATOR_H_
6 #define UI_AURA_TEST_EVENT_GENERATOR_H_ 6 #define UI_AURA_TEST_EVENT_GENERATOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "ui/base/keycodes/keyboard_codes.h"
10 #include "ui/gfx/point.h" 11 #include "ui/gfx/point.h"
11 12
12 namespace aura { 13 namespace aura {
13 class Event; 14 class Event;
14 class Window; 15 class Window;
15 16
16 namespace test { 17 namespace test {
17 18
18 // EventGenerator is a tool that generates and dispatch events. 19 // EventGenerator is a tool that generates and dispatch events.
19 // TODO(oshima): Support key events.
20 class EventGenerator { 20 class EventGenerator {
21 public: 21 public:
22 // Creates an EventGenerator with the mouse location (0,0). 22 // Creates an EventGenerator with the mouse location (0,0).
23 EventGenerator(); 23 EventGenerator();
24 24
25 // Creates an EventGenerator with the mouse location at |initial_location|. 25 // Creates an EventGenerator with the mouse location at |initial_location|.
26 explicit EventGenerator(const gfx::Point& initial_location); 26 explicit EventGenerator(const gfx::Point& initial_location);
27 27
28 // Creates an EventGenerator with the mouse location centered over |window|. 28 // Creates an EventGenerator with the mouse location centered over |window|.
29 explicit EventGenerator(Window* window); 29 explicit EventGenerator(Window* window);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 DragMouseTo(gfx::Point(x, y)); 62 DragMouseTo(gfx::Point(x, y));
63 } 63 }
64 64
65 void DragMouseBy(int dx, int dy) { 65 void DragMouseBy(int dx, int dy) {
66 DragMouseTo(current_location_.Add(gfx::Point(dx, dy))); 66 DragMouseTo(current_location_.Add(gfx::Point(dx, dy)));
67 } 67 }
68 68
69 // Generates events to move the mouse to the center of the window. 69 // Generates events to move the mouse to the center of the window.
70 void MoveMouseToCenterOf(Window* window); 70 void MoveMouseToCenterOf(Window* window);
71 71
72 // Generates a key press event. On platforms except Windows and X11, a key
73 // event without native_event() is generated.
74 // TODO(yusukes): Support native_event() on all platforms.
75 void PressKey(ui::KeyboardCode key_code, int flags);
76
77 // Generates a key release event. On platforms except Windows and X11, a key
78 // event without native_event() is generated.
79 // TODO(yusukes): Support native_event() on all platforms.
80 void ReleaseKey(ui::KeyboardCode key_code, int flags);
81
72 private: 82 private:
73 // Dispatch the |event| to the Desktop. 83 // Dispatch the |event| to the RootWindow.
74 void Dispatch(Event& event); 84 void Dispatch(Event& event);
85 // Dispatch a key event to the RootWindow.
86 void DispatchKeyEvent(bool is_press, ui::KeyboardCode key_code, int flags);
75 87
76 int flags_; 88 int flags_;
77 gfx::Point current_location_; 89 gfx::Point current_location_;
78 90
79 DISALLOW_COPY_AND_ASSIGN(EventGenerator); 91 DISALLOW_COPY_AND_ASSIGN(EventGenerator);
80 }; 92 };
81 93
82 } // namespace test 94 } // namespace test
83 } // namespace aura 95 } // namespace aura
84 96
85 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_ 97 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698