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

Unified Diff: ui/events/test/events_test_utils_x11.cc

Issue 306483003: Prepare for Unified Gesture Recognizer landing in Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix non-monotonic timestamps Created 6 years, 7 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
Index: ui/events/test/events_test_utils_x11.cc
diff --git a/ui/events/test/events_test_utils_x11.cc b/ui/events/test/events_test_utils_x11.cc
index 67b16818cbb489031c67e045544aaa67c25fb099..f858e788d3e7b1ddde0e545486ec47f73bbc8e7a 100644
--- a/ui/events/test/events_test_utils_x11.cc
+++ b/ui/events/test/events_test_utils_x11.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "ui/events/event_constants.h"
+#include "ui/events/event_utils.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
#include "ui/events/x/touch_factory_x11.h"
@@ -238,7 +239,19 @@ void ScopedXI2Event::InitTouchEvent(int deviceid,
const gfx::Point& location,
const std::vector<Valuator>& valuators) {
event_.reset(CreateXInput2Event(deviceid, evtype, tracking_id, location));
- SetUpValuators(valuators);
+
+ // If a timestamp was specified, setup the event.
+ for (size_t i = 0; i < valuators.size(); ++i) {
+ if (valuators[i].data_type == DeviceDataManager::DT_TOUCH_RAW_TIMESTAMP)
+ SetUpValuators(valuators);
sadrul 2014/06/02 13:31:23 Did you mean to return from here?
tdresser 2014/06/02 14:00:38 Thanks for catching that. Done.
+ }
+
+ // No timestamp was specified. Use |ui::EventTimeForNow()|.
+ std::vector<Valuator> valuators_with_time = valuators;
+ valuators_with_time.push_back(
+ Valuator(DeviceDataManager::DT_TOUCH_RAW_TIMESTAMP,
+ (ui::EventTimeForNow()).InMicroseconds()));
+ SetUpValuators(valuators_with_time);
}
void ScopedXI2Event::SetUpValuators(const std::vector<Valuator>& valuators) {

Powered by Google App Engine
This is Rietveld 408576698