| 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
| 7 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 7 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| 8 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" | 8 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" |
| 9 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 9 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
| 10 #include "content/browser/renderer_host/input/synthetic_pinch_gesture.h" | 10 #include "content/browser/renderer_host/input/synthetic_pinch_gesture.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 class MockSyntheticGesture : public SyntheticGesture { | 36 class MockSyntheticGesture : public SyntheticGesture { |
| 37 public: | 37 public: |
| 38 MockSyntheticGesture(bool* finished, int num_steps) | 38 MockSyntheticGesture(bool* finished, int num_steps) |
| 39 : finished_(finished), | 39 : finished_(finished), |
| 40 num_steps_(num_steps), | 40 num_steps_(num_steps), |
| 41 step_count_(0) { | 41 step_count_(0) { |
| 42 *finished_ = false; | 42 *finished_ = false; |
| 43 } | 43 } |
| 44 virtual ~MockSyntheticGesture() {} | 44 virtual ~MockSyntheticGesture() {} |
| 45 | 45 |
| 46 virtual Result ForwardInputEvents(const base::TimeDelta& interval, | 46 virtual Result ForwardInputEvents(const base::TimeTicks& timestamp, |
| 47 SyntheticGestureTarget* target) OVERRIDE { | 47 SyntheticGestureTarget* target) OVERRIDE { |
| 48 step_count_++; | 48 step_count_++; |
| 49 if (step_count_ == num_steps_) { | 49 if (step_count_ == num_steps_) { |
| 50 *finished_ = true; | 50 *finished_ = true; |
| 51 return SyntheticGesture::GESTURE_FINISHED; | 51 return SyntheticGesture::GESTURE_FINISHED; |
| 52 } else if (step_count_ > num_steps_) { | 52 } else if (step_count_ > num_steps_) { |
| 53 *finished_ = true; | 53 *finished_ = true; |
| 54 // Return arbitrary failure. | 54 // Return arbitrary failure. |
| 55 return SyntheticGesture::GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED; | 55 return SyntheticGesture::GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED; |
| 56 } | 56 } |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 EXPECT_EQ(0, target_->num_failure()); | 805 EXPECT_EQ(0, target_->num_failure()); |
| 806 EXPECT_TRUE(tap_target->GestureFinished()); | 806 EXPECT_TRUE(tap_target->GestureFinished()); |
| 807 EXPECT_EQ(tap_target->position(), params.position); | 807 EXPECT_EQ(tap_target->position(), params.position); |
| 808 EXPECT_GE(GetTotalTime(), | 808 EXPECT_GE(GetTotalTime(), |
| 809 base::TimeDelta::FromMilliseconds(params.duration_ms)); | 809 base::TimeDelta::FromMilliseconds(params.duration_ms)); |
| 810 } | 810 } |
| 811 | 811 |
| 812 } // namespace | 812 } // namespace |
| 813 | 813 |
| 814 } // namespace content | 814 } // namespace content |
| OLD | NEW |