• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef UI_EVENTS_TEST_EVENTS_TEST_UTILS_H_
6 #define UI_EVENTS_TEST_EVENTS_TEST_UTILS_H_
7 
8 #include "ui/events/event.h"
9 #include "ui/events/event_target.h"
10 
11 namespace ui {
12 
13 class EventTestApi {
14  public:
15   explicit EventTestApi(Event* event);
16   virtual ~EventTestApi();
17 
set_time_stamp(base::TimeDelta time_stamp)18   void set_time_stamp(base::TimeDelta time_stamp) {
19     event_->time_stamp_ = time_stamp;
20   }
21 
22  private:
23   EventTestApi();
24 
25   Event* event_;
26 
27   DISALLOW_COPY_AND_ASSIGN(EventTestApi);
28 };
29 
30 class LocatedEventTestApi : public EventTestApi {
31  public:
32   explicit LocatedEventTestApi(LocatedEvent* located_event);
33   virtual ~LocatedEventTestApi();
34 
set_location(const gfx::Point & location)35   void set_location(const gfx::Point& location) {
36     located_event_->location_ = location;
37   }
38 
39  private:
40   LocatedEventTestApi();
41 
42   LocatedEvent* located_event_;
43 
44   DISALLOW_COPY_AND_ASSIGN(LocatedEventTestApi);
45 };
46 
47 class EventTargetTestApi {
48  public:
49   explicit EventTargetTestApi(EventTarget* target);
50 
pre_target_handlers()51   const EventHandlerList& pre_target_handlers() {
52     return target_->pre_target_list_;
53   }
54 
55  private:
56   EventTargetTestApi();
57 
58   EventTarget* target_;
59 
60   DISALLOW_COPY_AND_ASSIGN(EventTargetTestApi);
61 };
62 
63 }  // namespace ui
64 
65 #endif  // UI_EVENTS_TEST_EVENTS_TEST_UTILS_H_
66