diff options
Diffstat (limited to 'ui/aura/test/test_window_delegate.h')
-rw-r--r-- | ui/aura/test/test_window_delegate.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/ui/aura/test/test_window_delegate.h b/ui/aura/test/test_window_delegate.h index 4eb8e2d..29be9fa 100644 --- a/ui/aura/test/test_window_delegate.h +++ b/ui/aura/test/test_window_delegate.h @@ -6,6 +6,8 @@ #define UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ #pragma once +#include <string> + #include "base/compiler_specific.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/aura/window_delegate.h" @@ -91,6 +93,39 @@ class MaskedWindowDelegate : public TestWindowDelegate { DISALLOW_COPY_AND_ASSIGN(MaskedWindowDelegate); }; +// Keeps track of mouse/key events. +class EventCountDelegate : public TestWindowDelegate { + public: + EventCountDelegate(); + + // Overridden from TestWindowDelegate: + virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; + virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; + + // Returns the counts of mouse motion events in the + // form of "<enter> <move> <leave>". + std::string GetMouseMotionCountsAndReset(); + + // Returns the counts of mouse button events in the + // form of "<press> <release>". + std::string GetMouseButtonCountsAndReset(); + + // Returns the counts of key events in the form of + // "<press> <release>". + std::string GetKeyCountsAndReset(); + + private: + int mouse_enter_count_; + int mouse_move_count_; + int mouse_leave_count_; + int mouse_press_count_; + int mouse_release_count_; + int key_press_count_; + int key_release_count_; + + DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); +}; + } // namespace test } // namespace aura |