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

Unified Diff: ui/aura/test/event_generator.cc

Issue 11591006: Track input latency with UMA stats (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added per event type histograms Created 7 years, 11 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/aura/gestures/gesture_recognizer_unittest.cc ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/event_generator.cc
diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc
index 2a6daea966b4c9ff53fade5b652bac0228c5eaab..6c55ff4c7b960546a8ce03860239aa456aa5661e 100644
--- a/ui/aura/test/event_generator.cc
+++ b/ui/aura/test/event_generator.cc
@@ -7,6 +7,7 @@
#include "base/memory/scoped_ptr.h"
#include "ui/aura/root_window.h"
#include "ui/base/events/event.h"
+#include "ui/base/events/event_utils.h"
#include "ui/gfx/vector2d_conversions.h"
#if defined(USE_X11)
@@ -33,8 +34,7 @@ class TestTouchEvent : public ui::TouchEvent {
TestTouchEvent(ui::EventType type,
const gfx::Point& root_location,
int flags)
- : TouchEvent(type, root_location, 0,
- base::Time::NowFromSystemTime() - base::Time()) {
+ : TouchEvent(type, root_location, 0, ui::EventTimeForNow()) {
set_flags(flags);
}
@@ -186,8 +186,10 @@ void EventGenerator::PressMoveAndReleaseTouchToCenterOf(Window* window) {
void EventGenerator::GestureTapAt(const gfx::Point& location) {
const int kTouchId = 2;
- ui::TouchEvent press(ui::ET_TOUCH_PRESSED, location, kTouchId,
- base::Time::NowFromSystemTime() - base::Time());
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
+ location,
+ kTouchId,
+ ui::EventTimeForNow());
Dispatch(press);
ui::TouchEvent release(
@@ -198,9 +200,10 @@ void EventGenerator::GestureTapAt(const gfx::Point& location) {
void EventGenerator::GestureTapDownAndUp(const gfx::Point& location) {
const int kTouchId = 3;
- ui::TouchEvent press(
- ui::ET_TOUCH_PRESSED, location, kTouchId,
- base::Time::NowFromSystemTime() - base::Time());
+ ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
+ location,
+ kTouchId,
+ ui::EventTimeForNow());
Dispatch(press);
ui::TouchEvent release(
@@ -214,7 +217,7 @@ void EventGenerator::GestureScrollSequence(const gfx::Point& start,
const base::TimeDelta& step_delay,
int steps) {
const int kTouchId = 5;
- base::TimeDelta timestamp = base::Time::NowFromSystemTime() - base::Time();
+ base::TimeDelta timestamp = ui::EventTimeForNow();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, start, kTouchId, timestamp);
Dispatch(press);
@@ -246,7 +249,7 @@ void EventGenerator::GestureMultiFingerScroll(int count,
int delta_x = move_x / steps;
int delta_y = move_y / steps;
- base::TimeDelta press_time = base::Time::NowFromSystemTime() - base::Time();
+ base::TimeDelta press_time = ui::EventTimeForNow();
for (int i = 0; i < count; ++i) {
points[i] = start[i];
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, points[i], i, press_time);
« no previous file with comments | « ui/aura/gestures/gesture_recognizer_unittest.cc ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698