1 // Copyright 2013 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.
5 #ifndef UI_EVENTS_TEST_EVENTS_TEST_UTILS_H_
6 #define UI_EVENTS_TEST_EVENTS_TEST_UTILS_H_
8 #include "ui/events/event.h"
9 #include "ui/events/event_dispatcher.h"
10 #include "ui/events/event_target.h"
18 explicit EventTestApi(Event* event);
19 virtual ~EventTestApi();
21 void set_time_stamp(base::TimeDelta time_stamp) {
22 event_->time_stamp_ = time_stamp;
25 void set_source_device_id(int source_device_id) {
26 event_->source_device_id_ = source_device_id;
34 DISALLOW_COPY_AND_ASSIGN(EventTestApi);
37 class LocatedEventTestApi : public EventTestApi {
39 explicit LocatedEventTestApi(LocatedEvent* located_event);
40 virtual ~LocatedEventTestApi();
42 void set_location(const gfx::Point& location) {
43 located_event_->location_ = location;
47 LocatedEventTestApi();
49 LocatedEvent* located_event_;
51 DISALLOW_COPY_AND_ASSIGN(LocatedEventTestApi);
54 class KeyEventTestApi : public EventTestApi {
56 explicit KeyEventTestApi(KeyEvent* key_event);
57 virtual ~KeyEventTestApi();
59 void set_is_char(bool is_char) {
60 key_event_->set_is_char(is_char);
68 DISALLOW_COPY_AND_ASSIGN(KeyEventTestApi);
71 class EventTargetTestApi {
73 explicit EventTargetTestApi(EventTarget* target);
75 const EventHandlerList& pre_target_handlers() {
76 return target_->pre_target_list_;
84 DISALLOW_COPY_AND_ASSIGN(EventTargetTestApi);
87 class EventSourceTestApi {
89 explicit EventSourceTestApi(EventSource* event_source);
91 EventDispatchDetails SendEventToProcessor(Event* event) WARN_UNUSED_RESULT;
96 EventSource* event_source_;
98 DISALLOW_COPY_AND_ASSIGN(EventSourceTestApi);
103 #endif // UI_EVENTS_TEST_EVENTS_TEST_UTILS_H_