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

Unified Diff: ui/chromeos/touch_exploration_controller_unittest.cc

Issue 2100453002: Remove unnecessary mocking of TickClock for events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@614409-confirm-timestamp-timebase
Patch Set: rebase Created 4 years, 6 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/chromeos/touch_exploration_controller_unittest.cc
diff --git a/ui/chromeos/touch_exploration_controller_unittest.cc b/ui/chromeos/touch_exploration_controller_unittest.cc
index d811d2bca9e4df6e709ddb75edefad3d68d84d55..5582113373b1f0170347e3fa4cd2737e1de32d56 100644
--- a/ui/chromeos/touch_exploration_controller_unittest.cc
+++ b/ui/chromeos/touch_exploration_controller_unittest.cc
@@ -176,10 +176,6 @@ class TouchExplorationControllerTestApi {
return touch_exploration_controller_->kSlopDistanceFromEdge;
}
- void SetTickClockForTesting(base::TickClock* simulated_clock) {
- touch_exploration_controller_->tick_clock_ = simulated_clock;
- }
-
void SetTouchAccessibilityAnchorPoint(const gfx::Point& location) {
touch_exploration_controller_->SetTouchAccessibilityAnchorPoint(location);
}
@@ -205,8 +201,8 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
cursor_client_.reset(new aura::test::TestCursorClient(root_window()));
root_window()->AddPreTargetHandler(&event_capturer_);
generator_.reset(new test::EventGenerator(root_window()));
- // The generator takes ownership of the tick clock.
- generator_->SetTickClock(
+ // ui takes ownership of the tick clock.
+ ui::SetEventTickClockForTesting(
std::unique_ptr<base::TickClock>(simulated_clock_));
cursor_client()->ShowCursor();
cursor_client()->DisableMouseEvents();
@@ -283,11 +279,6 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
touch_exploration_controller_->SuppressVLOGsForTesting(suppress);
}
- void SetTickClock() {
- touch_exploration_controller_->SetTickClockForTesting(
- static_cast<base::TickClock*>(simulated_clock_));
- }
-
void SwitchTouchExplorationMode(bool on) {
if (!on && touch_exploration_controller_.get()) {
touch_exploration_controller_.reset();
@@ -392,11 +383,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
return touch_exploration_controller_->GetSlopDistanceFromEdge();
}
- base::TimeTicks Now() {
- // This is the same as what EventTimeForNow() does, but here we do it
- // with our simulated clock.
- return simulated_clock_->NowTicks();
- }
+ base::TimeTicks Now() { return ui::EventTimeForNow(); }
void SetTouchAccessibilityAnchorPoint(const gfx::Point& location) {
touch_exploration_controller_->SetTouchAccessibilityAnchorPoint(location);
@@ -404,7 +391,7 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
std::unique_ptr<test::EventGenerator> generator_;
ui::GestureDetector::Config gesture_detector_config_;
- // Owned by |generator_|.
+ // Owned by |ui|.
base::SimpleTestTickClock* simulated_clock_;
MockTouchExplorationControllerDelegate delegate_;
@@ -846,7 +833,6 @@ TEST_F(TouchExplorationTest, DoubleTapPassthrough) {
// to the location of the last successful touch exploration.
TEST_F(TouchExplorationTest, DoubleTapLongPress) {
SwitchTouchExplorationMode(true);
- SetTickClock();
// Tap at one location, and get a mouse move event.
gfx::Point tap_location(11, 12);
generator_->set_current_location(tap_location);

Powered by Google App Engine
This is Rietveld 408576698