summaryrefslogtreecommitdiff
path: root/chromium/ui/aura/gestures/gesture_recognizer_unittest.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-08-01 12:59:39 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-04 12:40:43 +0000
commit28b1110370900897ab652cb420c371fab8857ad4 (patch)
tree41b32127d23b0df4f2add2a27e12dc87bddb260e /chromium/ui/aura/gestures/gesture_recognizer_unittest.cc
parent399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (diff)
downloadqtwebengine-chromium-28b1110370900897ab652cb420c371fab8857ad4.tar.gz
BASELINE: Update Chromium to 53.0.2785.41
Also adds a few extra files for extensions. Change-Id: Iccdd55d98660903331cf8b7b29188da781830af4 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/ui/aura/gestures/gesture_recognizer_unittest.cc')
-rw-r--r--chromium/ui/aura/gestures/gesture_recognizer_unittest.cc45
1 files changed, 24 insertions, 21 deletions
diff --git a/chromium/ui/aura/gestures/gesture_recognizer_unittest.cc b/chromium/ui/aura/gestures/gesture_recognizer_unittest.cc
index fc4e5842115..e7444067477 100644
--- a/chromium/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/chromium/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -7,9 +7,13 @@
#include <list>
#include "base/command_line.h"
+#include "base/location.h"
#include "base/macros.h"
#include "base/run_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
+#include "base/test/simple_test_tick_clock.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "base/timer/timer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/env.h"
@@ -481,27 +485,29 @@ class ScopedGestureRecognizerSetter {
class TimedEvents {
private:
- int simulated_now_;
+ base::SimpleTestTickClock tick_clock_;
public:
// Use a non-zero start time to pass DCHECKs which ensure events have had a
// time assigned.
- TimedEvents() : simulated_now_(1) {
+ TimedEvents() {
+ tick_clock_.Advance(base::TimeDelta::FromMilliseconds(1));
}
- base::TimeDelta Now() {
- base::TimeDelta t = base::TimeDelta::FromMilliseconds(simulated_now_);
- simulated_now_++;
+ base::TimeTicks Now() {
+ base::TimeTicks t = tick_clock_.NowTicks();
+ tick_clock_.Advance(base::TimeDelta::FromMilliseconds(1));
return t;
}
- base::TimeDelta LeapForward(int time_in_millis) {
- simulated_now_ += time_in_millis;
- return base::TimeDelta::FromMilliseconds(simulated_now_);
+ base::TimeTicks LeapForward(int time_in_millis) {
+ tick_clock_.Advance(base::TimeDelta::FromMilliseconds(time_in_millis));
+ return tick_clock_.NowTicks();
}
- base::TimeDelta InFuture(int time_in_millis) {
- return base::TimeDelta::FromMilliseconds(simulated_now_ + time_in_millis);
+ base::TimeTicks InFuture(int time_in_millis) {
+ return tick_clock_.NowTicks() +
+ base::TimeDelta::FromMilliseconds(time_in_millis);
}
void SendScrollEvents(ui::EventProcessor* dispatcher,
@@ -510,7 +516,7 @@ class TimedEvents {
int dx,
int dy,
int touch_id,
- int time_step,
+ int time_step_ms,
int num_steps,
GestureEventConsumeDelegate* delegate) {
float x = x_start;
@@ -520,10 +526,10 @@ class TimedEvents {
x += dx;
y += dy;
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(x, y), touch_id,
- base::TimeDelta::FromMilliseconds(simulated_now_));
+ tick_clock_.NowTicks());
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
- simulated_now_ += time_step;
+ tick_clock_.Advance(base::TimeDelta::FromMilliseconds(time_step_ms));
}
}
@@ -534,12 +540,11 @@ class TimedEvents {
GestureEventConsumeDelegate* delegate) {
delegate->Reset();
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(), touch_id,
- base::TimeDelta::FromMilliseconds(simulated_now_));
+ Now());
move.set_location_f(gfx::PointF(x, y));
move.set_root_location_f(gfx::PointF(x, y));
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed);
- simulated_now_++;
}
};
@@ -621,9 +626,8 @@ class RemoveOnTouchCancelHandler : public TestEventHandler {
void DelayByLongPressTimeout() {
ui::GestureProvider::Config config;
base::RunLoop run_loop;
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- run_loop.QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, run_loop.QuitClosure(),
config.gesture_detector_config.longpress_timeout * 2);
run_loop.Run();
}
@@ -631,9 +635,8 @@ void DelayByLongPressTimeout() {
void DelayByShowPressTimeout() {
ui::GestureProvider::Config config;
base::RunLoop run_loop;
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- run_loop.QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, run_loop.QuitClosure(),
config.gesture_detector_config.showpress_timeout * 2);
run_loop.Run();
}