| Index: ui/aura/test/event_generator.cc
|
| diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc
|
| index ecfa63becdef9535a9a8fc13d97a57bc24d3c661..9d7b0a314562180a667874eb56f0ebe9aae4567a 100644
|
| --- a/ui/aura/test/event_generator.cc
|
| +++ b/ui/aura/test/event_generator.cc
|
| @@ -69,8 +69,9 @@ class TestTouchEvent : public ui::TouchEvent {
|
| TestTouchEvent(ui::EventType type,
|
| const gfx::Point& root_location,
|
| int touch_id,
|
| - int flags)
|
| - : TouchEvent(type, root_location, flags, touch_id, ui::EventTimeForNow(),
|
| + int flags,
|
| + base::TimeDelta timestamp)
|
| + : TouchEvent(type, root_location, flags, touch_id, timestamp,
|
| 1.0f, 1.0f, 1.0f, 1.0f) {
|
| }
|
|
|
| @@ -219,7 +220,8 @@ void EventGenerator::PressTouch() {
|
|
|
| void EventGenerator::PressTouchId(int touch_id) {
|
| TestTouchEvent touchev(
|
| - ui::ET_TOUCH_PRESSED, GetLocationInCurrentRoot(), touch_id, flags_);
|
| + ui::ET_TOUCH_PRESSED, GetLocationInCurrentRoot(), touch_id, flags_,
|
| + Now());
|
| Dispatch(&touchev);
|
| }
|
|
|
| @@ -230,7 +232,7 @@ void EventGenerator::MoveTouch(const gfx::Point& point) {
|
| void EventGenerator::MoveTouchId(const gfx::Point& point, int touch_id) {
|
| current_location_ = point;
|
| TestTouchEvent touchev(
|
| - ui::ET_TOUCH_MOVED, GetLocationInCurrentRoot(), touch_id, flags_);
|
| + ui::ET_TOUCH_MOVED, GetLocationInCurrentRoot(), touch_id, flags_, Now());
|
| Dispatch(&touchev);
|
|
|
| if (!grab_)
|
| @@ -243,7 +245,8 @@ void EventGenerator::ReleaseTouch() {
|
|
|
| void EventGenerator::ReleaseTouchId(int touch_id) {
|
| TestTouchEvent touchev(
|
| - ui::ET_TOUCH_RELEASED, GetLocationInCurrentRoot(), touch_id, flags_);
|
| + ui::ET_TOUCH_RELEASED, GetLocationInCurrentRoot(), touch_id, flags_,
|
| + Now());
|
| Dispatch(&touchev);
|
| }
|
|
|
| @@ -263,7 +266,7 @@ void EventGenerator::GestureEdgeSwipe() {
|
| 0,
|
| 0,
|
| 0,
|
| - ui::EventTimeForNow(),
|
| + Now(),
|
| ui::GestureEventDetails(ui::ET_GESTURE_WIN8_EDGE_SWIPE, 0, 0),
|
| 0);
|
| Dispatch(&gesture);
|
| @@ -274,7 +277,7 @@ void EventGenerator::GestureTapAt(const gfx::Point& location) {
|
| ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
|
| location,
|
| kTouchId,
|
| - ui::EventTimeForNow());
|
| + Now());
|
| Dispatch(&press);
|
|
|
| ui::TouchEvent release(
|
| @@ -288,7 +291,7 @@ void EventGenerator::GestureTapDownAndUp(const gfx::Point& location) {
|
| ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
|
| location,
|
| kTouchId,
|
| - ui::EventTimeForNow());
|
| + Now());
|
| Dispatch(&press);
|
|
|
| ui::TouchEvent release(
|
| @@ -312,7 +315,7 @@ void EventGenerator::GestureScrollSequenceWithCallback(
|
| int steps,
|
| const ScrollStepCallback& callback) {
|
| const int kTouchId = 5;
|
| - base::TimeDelta timestamp = ui::EventTimeForNow();
|
| + base::TimeDelta timestamp = Now();
|
| ui::TouchEvent press(ui::ET_TOUCH_PRESSED, start, kTouchId, timestamp);
|
| Dispatch(&press);
|
|
|
| @@ -367,7 +370,7 @@ void EventGenerator::GestureMultiFingerScrollWithDelays(
|
| points[i] = start[i];
|
| }
|
|
|
| - base::TimeDelta press_time_first = ui::EventTimeForNow();
|
| + base::TimeDelta press_time_first = Now();
|
| base::TimeDelta press_time[kMaxTouchPoints];
|
| bool pressed[kMaxTouchPoints];
|
| for (int i = 0; i < count; ++i) {
|
| @@ -417,8 +420,7 @@ void EventGenerator::ScrollSequence(const gfx::Point& start,
|
| float y_offset,
|
| int steps,
|
| int num_fingers) {
|
| - base::TimeDelta timestamp = base::TimeDelta::FromInternalValue(
|
| - base::TimeTicks::Now().ToInternalValue());
|
| + base::TimeDelta timestamp = Now();
|
| ui::ScrollEvent fling_cancel(ui::ET_SCROLL_FLING_CANCEL,
|
| start,
|
| timestamp,
|
| @@ -457,7 +459,7 @@ void EventGenerator::ScrollSequence(const gfx::Point& start,
|
| const std::vector<gfx::Point>& offsets,
|
| int num_fingers) {
|
| int steps = offsets.size();
|
| - base::TimeDelta timestamp = ui::EventTimeForNow();
|
| + base::TimeDelta timestamp = Now();
|
| ui::ScrollEvent fling_cancel(ui::ET_SCROLL_FLING_CANCEL,
|
| start,
|
| timestamp,
|
| @@ -638,6 +640,11 @@ void EventGenerator::DispatchNextPendingEvent() {
|
| }
|
| }
|
|
|
| +base::TimeDelta EventGenerator::Now() {
|
| + if (simulated_time_ != base::TimeDelta())
|
| + return simulated_time_;
|
| + return ui::EventTimeForNow();
|
| +}
|
|
|
| } // namespace test
|
| } // namespace aura
|
|
|