Chromium Code Reviews| 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..0035fccd39ffde4e8451e167851672687b6ae8bd |
| --- /dev/null |
| +++ b/ui/aura/test/event_generator.h |
| @@ -0,0 +1,68 @@ |
| +// 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; |
| + |
| +namespace test { |
| + |
| +// EventGenerator is a tool that generates and dispatch events for |
| +// 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.
|
| +// TODO(oshima): Support key event |
|
Ben Goodger (Google)
2011/10/15 05:36:30
events.
oshima
2011/10/15 17:47:06
Done.
|
| +class EventGenerator { |
| + public: |
| + EventGenerator(); |
| + EventGenerator(const gfx::Point& initial_location); |
|
Ben Goodger (Google)
2011/10/15 05:36:30
explicit
|
| + virtual ~EventGenerator(); |
| + |
| + // Generates a left button press event. |
| + void PressLeftButton(); |
| + |
| + // Generates a left button release event. |
| + void ReleaseLeftButton(); |
| + |
| + // 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.
|
| + void ClickLeftButton(); |
| + |
| + // 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.
|
| + void MoveMouseTo(const gfx::Point& point); |
| + |
| + void MoveMouseTo(int x, int y) { |
| + MoveMouseTo(gfx::Point(x, y)); |
| + } |
| + |
| + 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.
|
| + MoveMouseTo(current_.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 x, int y) { |
| + MoveMouseTo(current_.Add(gfx::Point(x, y))); |
| + } |
| + |
| + private: |
| + // Dispatch the |event| to desktop. |
|
Ben Goodger (Google)
2011/10/15 05:36:30
Dispatch |event| to the Desktop.
|
| + void Dispatch(const Event& event); |
| + |
| + int flags_; |
| + gfx::Point current_; |
| +}; |
| + |
| +} // namespace test |
| +} // namespace aura |
| + |
| +#endif // UI_AURA_TEST_EVENT_GENERATOR_H_ |