Chromium Code Reviews| Index: components/mus/ws/event_tester.h |
| diff --git a/components/mus/ws/event_tester.h b/components/mus/ws/event_tester.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..46e9c3237bd6677d29b6cc308bbf3c39e1536488 |
| --- /dev/null |
| +++ b/components/mus/ws/event_tester.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2016 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 COMPONENTS_MUS_WS_EVENT_TESTER_H_ |
| +#define COMPONENTS_MUS_WS_EVENT_TESTER_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include "base/macros.h" |
| +#include "components/mus/public/interfaces/input_event_constants.mojom.h" |
| +#include "components/mus/public/interfaces/input_event_matcher.mojom.h" |
| +#include "components/mus/public/interfaces/input_key_codes.mojom.h" |
| +#include "ui/events/event.h" |
| +#include "ui/gfx/geometry/rect_f.h" |
| + |
| +namespace mus { |
| +namespace ws { |
| + |
| +// Wraps a mojom::EventMatcher and allows events to be tested against it. |
|
sky
2016/04/21 17:23:03
The reason we started putting the interfaces/struc
James Cook
2016/04/22 18:22:54
Done. There was a different file called event_matc
|
| +class EventTester { |
| + public: |
| + explicit EventTester(const mojom::EventMatcher& matcher); |
| + ~EventTester(); |
| + |
| + bool MatchesEvent(const ui::Event& event) const; |
| + |
| + bool Equals(const EventTester& other) const; |
| + |
| + private: |
| + enum MatchFields { |
| + NONE = 0, |
| + TYPE = 1 << 0, |
| + FLAGS = 1 << 1, |
| + KEYBOARD_CODE = 1 << 2, |
| + POINTER_KIND = 1 << 3, |
| + POINTER_LOCATION = 1 << 4, |
| + }; |
| + |
| + uint32_t fields_to_match_; |
| + ui::EventType event_type_; |
| + // Bitfields of kEventFlag* and kMouseEventFlag* values in |
| + // input_event_constants.mojom. |
| + int event_flags_; |
| + int ignore_event_flags_; |
| + uint16_t keyboard_code_; |
| + ui::EventPointerType pointer_type_; |
| + gfx::RectF pointer_region_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(EventTester); |
| +}; |
| + |
| +} // namespace ws |
| +} // namespace mus |
| + |
| +#endif // COMPONENTS_MUS_WS_EVENT_TESTER_H_ |