OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 8 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
9 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" | 9 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" |
10 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 10 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 case FINISHED: | 352 case FINISHED: |
353 EXPECT_FALSE(true); | 353 EXPECT_FALSE(true); |
354 break; | 354 break; |
355 } | 355 } |
356 } | 356 } |
357 }; | 357 }; |
358 | 358 |
359 class SyntheticGestureControllerTest : public testing::Test { | 359 class SyntheticGestureControllerTest : public testing::Test { |
360 public: | 360 public: |
361 SyntheticGestureControllerTest() {} | 361 SyntheticGestureControllerTest() {} |
362 virtual ~SyntheticGestureControllerTest() {} | 362 ~SyntheticGestureControllerTest() override {} |
363 | 363 |
364 protected: | 364 protected: |
365 template<typename MockGestureTarget> | 365 template<typename MockGestureTarget> |
366 void CreateControllerAndTarget() { | 366 void CreateControllerAndTarget() { |
367 target_ = new MockGestureTarget(); | 367 target_ = new MockGestureTarget(); |
368 controller_.reset(new SyntheticGestureController( | 368 controller_.reset(new SyntheticGestureController( |
369 scoped_ptr<SyntheticGestureTarget>(target_))); | 369 scoped_ptr<SyntheticGestureTarget>(target_))); |
370 } | 370 } |
371 | 371 |
372 virtual void SetUp() override { | 372 void SetUp() override { |
373 start_time_ = base::TimeTicks::Now(); | 373 start_time_ = base::TimeTicks::Now(); |
374 time_ = start_time_; | 374 time_ = start_time_; |
375 num_success_ = 0; | 375 num_success_ = 0; |
376 num_failure_ = 0; | 376 num_failure_ = 0; |
377 } | 377 } |
378 | 378 |
379 virtual void TearDown() override { | 379 void TearDown() override { |
380 controller_.reset(); | 380 controller_.reset(); |
381 target_ = NULL; | 381 target_ = NULL; |
382 time_ = base::TimeTicks(); | 382 time_ = base::TimeTicks(); |
383 } | 383 } |
384 | 384 |
385 void QueueSyntheticGesture(scoped_ptr<SyntheticGesture> gesture) { | 385 void QueueSyntheticGesture(scoped_ptr<SyntheticGesture> gesture) { |
386 controller_->QueueSyntheticGesture(gesture.Pass(), | 386 controller_->QueueSyntheticGesture(gesture.Pass(), |
387 base::Bind(&SyntheticGestureControllerTest::OnSyntheticGestureCompleted, | 387 base::Bind(&SyntheticGestureControllerTest::OnSyntheticGestureCompleted, |
388 base::Unretained(this))); | 388 base::Unretained(this))); |
389 } | 389 } |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 EXPECT_TRUE(tap_target->GestureFinished()); | 985 EXPECT_TRUE(tap_target->GestureFinished()); |
986 EXPECT_EQ(tap_target->position(), params.position); | 986 EXPECT_EQ(tap_target->position(), params.position); |
987 EXPECT_EQ(tap_target->GetDuration().InMilliseconds(), params.duration_ms); | 987 EXPECT_EQ(tap_target->GetDuration().InMilliseconds(), params.duration_ms); |
988 EXPECT_GE(GetTotalTime(), | 988 EXPECT_GE(GetTotalTime(), |
989 base::TimeDelta::FromMilliseconds(params.duration_ms)); | 989 base::TimeDelta::FromMilliseconds(params.duration_ms)); |
990 } | 990 } |
991 | 991 |
992 } // namespace | 992 } // namespace |
993 | 993 |
994 } // namespace content | 994 } // namespace content |
OLD | NEW |