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

Unified Diff: ui/events/test/event_generator.h

Issue 2794213002: MacViews: Fix some TableView tests, add ui::EventGenerator::set_assume_window_at_origin(bool) (Closed)
Patch Set: Yeah. that's a lot of failures Created 3 years, 8 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 | « no previous file | ui/events/test/event_generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/test/event_generator.h
diff --git a/ui/events/test/event_generator.h b/ui/events/test/event_generator.h
index 51268390a42ba1637d3bae85982daa1b656e0e9e..1bd227926b902084cada49320f07198a37344423 100644
--- a/ui/events/test/event_generator.h
+++ b/ui/events/test/event_generator.h
@@ -159,6 +159,20 @@ class EventGenerator {
void set_flags(int flags) { flags_ = flags; }
int flags() const { return flags_; }
+ // Many tests assume a window created at (0,0) will remain there when shown.
+ // However, an operating system's window manager may reposition the window
+ // into the work area. This can disrupt the coordinates used on test events,
+ // so an EventGeneratorDelegate may skip the step that remaps coordinates in
+ // the root window to window coordinates when dispatching events.
+ // Setting this to false skips that step, in which case the test must ensure
+ // it correctly maps coordinates in window coordinates to root window (screen)
+ // coordinates when calling, e.g., set_current_location().
+ // Default is true. This only has any effect on Mac.
+ void set_assume_window_at_origin(bool assume_window_at_origin) {
sky 2017/04/05 15:39:53 Is a better name and description for this coordina
tapted 2017/04/05 23:57:18 I see how that would fit with the way the coordina
+ assume_window_at_origin_ = assume_window_at_origin;
+ }
+ bool assume_window_at_origin() { return assume_window_at_origin_; }
+
// Generates a left button press event.
void PressLeftButton();
@@ -446,15 +460,23 @@ class EventGenerator {
std::unique_ptr<EventGeneratorDelegate> delegate_;
gfx::Point current_location_;
- EventTarget* current_target_;
- int flags_;
- bool grab_;
+ EventTarget* current_target_ = nullptr;
+ int flags_ = 0;
+ bool grab_ = false;
+
ui::PointerDetails touch_pointer_details_;
std::list<std::unique_ptr<Event>> pending_events_;
+
// Set to true to cause events to be posted asynchronously.
- bool async_;
- Target target_;
+ bool async_ = false;
+
+ // Whether to skip mapping of coordinates from the root window to a hit window
+ // when dispatching events.
+ bool assume_window_at_origin_ = true;
tapted 2017/04/05 04:54:17 alternatively.. we could default this to `false` a
+
+ Target target_ = Target::WIDGET;
+
std::unique_ptr<base::TickClock> tick_clock_;
DISALLOW_COPY_AND_ASSIGN(EventGenerator);
« no previous file with comments | « no previous file | ui/events/test/event_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698