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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 virtual void LongPress(base::TimeTicks time, float x, float y) OVERRIDE { | 55 virtual void LongPress(base::TimeTicks time, float x, float y) OVERRIDE { |
56 event_log_.push_back("LongPress"); | 56 event_log_.push_back("LongPress"); |
57 } | 57 } |
58 | 58 |
59 protected: | 59 protected: |
60 static GestureEventData CreateGesture(ui::EventType type, | 60 static GestureEventData CreateGesture(ui::EventType type, |
61 base::TimeTicks event_time, | 61 base::TimeTicks event_time, |
62 float x, | 62 float x, |
63 float y) { | 63 float y) { |
64 return GestureEventData(GestureEventDetails(type), | 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 0); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // 4. TAP | 223 // 4. TAP |
224 event_time += base::TimeDelta::FromMilliseconds(10); | 224 event_time += base::TimeDelta::FromMilliseconds(10); |
225 const GestureEventData tap = | 225 const GestureEventData tap = |
226 CreateGesture(ui::ET_GESTURE_TAP, event_time, x1, y1); | 226 CreateGesture(ui::ET_GESTURE_TAP, event_time, x1, y1); |
227 EXPECT_TRUE(selector_->OnGestureEvent(tap)); | 227 EXPECT_TRUE(selector_->OnGestureEvent(tap)); |
228 EXPECT_EQ(1u, event_log_.size()); // LongPress | 228 EXPECT_EQ(1u, event_log_.size()); // LongPress |
229 EXPECT_STREQ("LongPress", event_log_.back().c_str()); | 229 EXPECT_STREQ("LongPress", event_log_.back().c_str()); |
230 } | 230 } |
231 | 231 |
232 } // namespace content | 232 } // namespace content |
OLD | NEW |