From 28b1110370900897ab652cb420c371fab8857ad4 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 1 Aug 2016 12:59:39 +0200 Subject: BASELINE: Update Chromium to 53.0.2785.41 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also adds a few extra files for extensions. Change-Id: Iccdd55d98660903331cf8b7b29188da781830af4 Reviewed-by: Michael BrĂ¼ning --- .../aura/gestures/gesture_recognizer_unittest.cc | 45 ++++++++++++---------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'chromium/ui/aura/gestures/gesture_recognizer_unittest.cc') 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 #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(); } -- cgit v1.2.1