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

Unified 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: self review + related fix for r283070 Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/controls/slider_unittest.cc ('k') | ui/views/test/widget_event_generator_aura.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/widget_event_generator.h
diff --git a/ui/views/test/widget_event_generator.h b/ui/views/test/widget_event_generator.h
new file mode 100644
index 0000000000000000000000000000000000000000..d356b13bad0d36835bff9d494e7a627a10216f8b
--- /dev/null
+++ b/ui/views/test/widget_event_generator.h
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_H_
+#define UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_H_
+
+#include "base/macros.h"
+#include "build/build_config.h"
+#include "ui/gfx/native_widget_types.h"
+
+#if defined(USE_AURA)
+#include "ui/aura/test/event_generator.h"
+#elif defined(OS_MACOSX)
+#include "ui/views/test/widget_event_generator_mac.h"
+#endif
+
+namespace views {
+class Widget;
+
+namespace test {
+
+#if defined(USE_AURA)
+typedef aura::test::EventGenerator PlatformEventGenerator;
+#elif defined(OS_MACOSX)
+typedef WidgetEventGeneratorMac PlatformEventGenerator;
+#endif
+
+// A cross-platform event generator that can dispatch events to a views::Widget
+// and will work correctly in a sharded non-interactive unit test. On Aura
+// builds, it is simply an aura::test::EventGenerator. On other platforms,
+// events are generated and dispatched to the native widget.
+class WidgetEventGenerator : public PlatformEventGenerator {
Ben Goodger (Google) 2014/07/15 16:22:20 Now that you've managed to hide the platform diffe
tapted 2014/07/16 07:56:07 Done. Took some juggling, but getting rid of these
+ public:
+ explicit WidgetEventGenerator(Widget* widget);
+ explicit WidgetEventGenerator(gfx::NativeView context);
+ WidgetEventGenerator(gfx::NativeView context,
+ Widget* window_for_initial_location);
+
+ virtual ~WidgetEventGenerator();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WidgetEventGenerator);
+};
+
+} // namespace test
+} // namespace views
+
+#endif // UI_VIEWS_TEST_WIDGET_EVENT_GENERATOR_H_
« no previous file with comments | « ui/views/controls/slider_unittest.cc ('k') | ui/views/test/widget_event_generator_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698