NaCl cleanup: Stop linking the old, glibc-based Non-SFI runtime into nacl_helper
[chromium-blink-merge.git] / ui / events / test / test_event_target.h
blob06ddc9914262d7a2c805cda0b7376bb41c17fbb3
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_TEST_EVENT_TARGET_H_
6 #define UI_EVENTS_TEST_TEST_EVENT_TARGET_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/memory/scoped_vector.h"
13 #include "ui/events/event_target.h"
15 typedef std::vector<std::string> HandlerSequenceRecorder;
17 namespace gfx {
18 class Point;
21 namespace ui {
22 namespace test {
24 class TestEventTarget : public EventTarget {
25 public:
26 TestEventTarget();
27 ~TestEventTarget() override;
29 void AddChild(scoped_ptr<TestEventTarget> child);
30 scoped_ptr<TestEventTarget> RemoveChild(TestEventTarget* child);
32 TestEventTarget* parent() { return parent_; }
34 void set_mark_events_as_handled(bool handle) {
35 mark_events_as_handled_ = handle;
38 TestEventTarget* child_at(int index) { return children_[index]; }
39 size_t child_count() const { return children_.size(); }
41 void SetEventTargeter(scoped_ptr<EventTargeter> targeter);
43 bool DidReceiveEvent(ui::EventType type) const;
44 void ResetReceivedEvents();
46 void set_recorder(HandlerSequenceRecorder* recorder) {
47 recorder_ = recorder;
49 void set_target_name(const std::string& target_name) {
50 target_name_ = target_name;
53 // EventTarget:
54 EventTargeter* GetEventTargeter() override;
56 protected:
57 bool Contains(TestEventTarget* target) const;
59 // EventTarget:
60 bool CanAcceptEvent(const ui::Event& event) override;
61 EventTarget* GetParentTarget() override;
62 scoped_ptr<EventTargetIterator> GetChildIterator() const override;
64 // EventHandler:
65 void OnEvent(Event* event) override;
67 private:
68 void set_parent(TestEventTarget* parent) { parent_ = parent; }
70 TestEventTarget* parent_;
71 ScopedVector<TestEventTarget> children_;
72 scoped_ptr<EventTargeter> targeter_;
73 bool mark_events_as_handled_;
75 std::set<ui::EventType> received_;
77 HandlerSequenceRecorder* recorder_;
78 std::string target_name_;
80 DISALLOW_COPY_AND_ASSIGN(TestEventTarget);
83 } // namespace test
84 } // namespace ui
86 #endif // UI_EVENTS_TEST_TEST_EVENT_TARGET_H_