Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: ui/views/test/widget_event_generator.h

Issue 322893005: MacViews: Add WidgetEventGenerator to abstract platform-specific event generation for tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cull orthogonal stuff, add WidgetTest.MouseEventTypesViaGenerator Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 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_VIEWS_TEST_WIDGET_EVENT_GENERATOR_H_
6 #define UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_H_
7
8 #include "base/macros.h"
9 #include "build/build_config.h"
10 #include "ui/gfx/native_widget_types.h"
11
12 #if defined(USE_AURA)
13 #include "ui/aura/test/event_generator.h"
14 #endif
15
16 #if defined(OS_MACOSX)
Andre 2014/06/17 21:17:56 The typedef below uses #elif, why is it different
tapted 2014/06/18 08:28:06 Done.
17 #include "ui/views/test/widget_event_generator_mac.h"
18 #endif
19
20 namespace views {
21 class Widget;
22
23 namespace test {
24
25 #if defined(USE_AURA)
26 typedef aura::test::EventGenerator PlatformEventGenerator;
27 #elif defined(OS_MACOSX)
28 typedef WidgetEventGeneratorMac PlatformEventGenerator;
29 #endif
30
31 // A cross-platform event generator that can dispatch events to a views::Widget
32 // and will work correctly in a sharded non-interactive unit test. On Aura
33 // builds, it is simply an aura::test::EventGenerator. On other platforms,
34 // events are generated and dispatched to the native widget.
35 class WidgetEventGenerator : public PlatformEventGenerator {
36 public:
37 explicit WidgetEventGenerator(Widget* widget);
38 explicit WidgetEventGenerator(gfx::NativeView context);
39 WidgetEventGenerator(gfx::NativeView context,
40 Widget* window_for_initial_location);
41
42 ~WidgetEventGenerator();
43
44 // Simulate a OS-level destruction of the native widget held by |widget|.
45 static void SimulateNativeDestroy(Widget* widget);
46
47 private:
48 DISALLOW_COPY_AND_ASSIGN(WidgetEventGenerator);
49 };
50
51 } // namespace test
52 } // namespace views
53
54 #endif // UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698