OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/renderer_host/input/gesture_text_selector.h" | 10 #include "content/browser/renderer_host/input/gesture_text_selector.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 float y) { | 63 float y) { |
64 return GestureEventData(GestureEventDetails(type, 0, 0), | 64 return GestureEventData(GestureEventDetails(type, 0, 0), |
65 0, | 65 0, |
66 MotionEvent::TOOL_TYPE_FINGER, | 66 MotionEvent::TOOL_TYPE_FINGER, |
67 event_time, | 67 event_time, |
68 x, | 68 x, |
69 y, | 69 y, |
70 x, | 70 x, |
71 y, | 71 y, |
72 1, | 72 1, |
73 gfx::RectF(0, 0, 0, 0)); | 73 gfx::RectF(0, 0, 0, 0), |
| 74 0); |
74 } | 75 } |
75 | 76 |
76 scoped_ptr<GestureTextSelector> selector_; | 77 scoped_ptr<GestureTextSelector> selector_; |
77 std::vector<std::string> event_log_; | 78 std::vector<std::string> event_log_; |
78 }; | 79 }; |
79 | 80 |
80 TEST_F(GestureTextSelectorTest, ShouldStartTextSelection) { | 81 TEST_F(GestureTextSelectorTest, ShouldStartTextSelection) { |
81 base::TimeTicks event_time = base::TimeTicks::Now(); | 82 base::TimeTicks event_time = base::TimeTicks::Now(); |
82 { // Touched with a finger. | 83 { // Touched with a finger. |
83 MockMotionEvent e(MotionEvent::ACTION_DOWN, event_time, 50.0f, 50.0f); | 84 MockMotionEvent e(MotionEvent::ACTION_DOWN, event_time, 50.0f, 50.0f); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // 4. TAP | 223 // 4. TAP |
223 event_time += base::TimeDelta::FromMilliseconds(10); | 224 event_time += base::TimeDelta::FromMilliseconds(10); |
224 const GestureEventData tap = | 225 const GestureEventData tap = |
225 CreateGesture(ui::ET_GESTURE_TAP, event_time, x1, y1); | 226 CreateGesture(ui::ET_GESTURE_TAP, event_time, x1, y1); |
226 EXPECT_TRUE(selector_->OnGestureEvent(tap)); | 227 EXPECT_TRUE(selector_->OnGestureEvent(tap)); |
227 EXPECT_EQ(1u, event_log_.size()); // LongPress | 228 EXPECT_EQ(1u, event_log_.size()); // LongPress |
228 EXPECT_STREQ("LongPress", event_log_.back().c_str()); | 229 EXPECT_STREQ("LongPress", event_log_.back().c_str()); |
229 } | 230 } |
230 | 231 |
231 } // namespace content | 232 } // namespace content |
OLD | NEW |