Update V8 to version 4.7.16.
[chromium-blink-merge.git] / ui / events / test / events_test_utils.h
blobd4b704a48531da69dd2a7010da9444141d38edce
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"
12 namespace ui {
14 class EventSource;
16 class EventTestApi {
17 public:
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;
29 private:
30 EventTestApi();
32 Event* event_;
34 DISALLOW_COPY_AND_ASSIGN(EventTestApi);
37 class LocatedEventTestApi : public EventTestApi {
38 public:
39 explicit LocatedEventTestApi(LocatedEvent* located_event);
40 ~LocatedEventTestApi() override;
42 void set_location(const gfx::Point& location) {
43 located_event_->location_ = location;
46 private:
47 LocatedEventTestApi();
49 LocatedEvent* located_event_;
51 DISALLOW_COPY_AND_ASSIGN(LocatedEventTestApi);
54 class KeyEventTestApi : public EventTestApi {
55 public:
56 explicit KeyEventTestApi(KeyEvent* key_event);
57 ~KeyEventTestApi() override;
59 void set_is_char(bool is_char) {
60 key_event_->set_is_char(is_char);
63 private:
64 KeyEventTestApi();
66 KeyEvent* key_event_;
68 DISALLOW_COPY_AND_ASSIGN(KeyEventTestApi);
71 class EventTargetTestApi {
72 public:
73 explicit EventTargetTestApi(EventTarget* target);
75 const EventHandlerList& pre_target_handlers() {
76 return target_->pre_target_list_;
79 private:
80 EventTargetTestApi();
82 EventTarget* target_;
84 DISALLOW_COPY_AND_ASSIGN(EventTargetTestApi);
87 class EventSourceTestApi {
88 public:
89 explicit EventSourceTestApi(EventSource* event_source);
91 EventDispatchDetails SendEventToProcessor(Event* event) WARN_UNUSED_RESULT;
93 private:
94 EventSourceTestApi();
96 EventSource* event_source_;
98 DISALLOW_COPY_AND_ASSIGN(EventSourceTestApi);
101 } // namespace ui
103 #endif // UI_EVENTS_TEST_EVENTS_TEST_UTILS_H_