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_dispatcher.h" 10#include "ui/events/event_target.h" 11 12namespace ui { 13 14class EventSource; 15 16class EventTestApi { 17 public: 18 explicit EventTestApi(Event* event); 19 virtual ~EventTestApi(); 20 21 void set_time_stamp(base::TimeDelta time_stamp) { 22 event_->time_stamp_ = time_stamp; 23 } 24 25 private: 26 EventTestApi(); 27 28 Event* event_; 29 30 DISALLOW_COPY_AND_ASSIGN(EventTestApi); 31}; 32 33class LocatedEventTestApi : public EventTestApi { 34 public: 35 explicit LocatedEventTestApi(LocatedEvent* located_event); 36 virtual ~LocatedEventTestApi(); 37 38 void set_location(const gfx::Point& location) { 39 located_event_->location_ = location; 40 } 41 42 private: 43 LocatedEventTestApi(); 44 45 LocatedEvent* located_event_; 46 47 DISALLOW_COPY_AND_ASSIGN(LocatedEventTestApi); 48}; 49 50class EventTargetTestApi { 51 public: 52 explicit EventTargetTestApi(EventTarget* target); 53 54 const EventHandlerList& pre_target_handlers() { 55 return target_->pre_target_list_; 56 } 57 58 private: 59 EventTargetTestApi(); 60 61 EventTarget* target_; 62 63 DISALLOW_COPY_AND_ASSIGN(EventTargetTestApi); 64}; 65 66class EventSourceTestApi { 67 public: 68 explicit EventSourceTestApi(EventSource* event_source); 69 70 EventDispatchDetails SendEventToProcessor(Event* event) WARN_UNUSED_RESULT; 71 72 private: 73 EventSourceTestApi(); 74 75 EventSource* event_source_; 76 77 DISALLOW_COPY_AND_ASSIGN(EventSourceTestApi); 78}; 79 80} // namespace ui 81 82#endif // UI_EVENTS_TEST_EVENTS_TEST_UTILS_H_ 83