1 // Copyright 2015 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_TARGETER_H_
6 #define UI_EVENTS_TEST_TEST_EVENT_TARGETER_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "ui/events/event_targeter.h"
15 class TestEventTarget
;
17 // An EventTargeter which is used to allow a bubbling behaviour in event
18 // dispatch: if an event is not handled after being dispatched to its
19 // |initial_target|, the event is dispatched to the next-best target as
20 // specified by FindNextBestTarget().
21 // Bubbling behaviour is controlled by |should_bubble| at creation time.
22 class TestEventTargeter
: public EventTargeter
{
24 TestEventTargeter(TestEventTarget
* initial_target
, bool should_bubble
);
25 ~TestEventTargeter() override
;
27 void set_target(TestEventTarget
* target
);
31 EventTarget
* FindTargetForEvent(EventTarget
* root
, Event
* event
) override
;
32 EventTarget
* FindNextBestTarget(EventTarget
* previous_target
,
33 Event
* event
) override
;
35 TestEventTarget
* target_
;
38 DISALLOW_COPY_AND_ASSIGN(TestEventTargeter
);
44 #endif // UI_EVENTS_TEST_TEST_EVENT_TARGETER_H_