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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 x2, y2, x2, y2, 1, gfx::RectF(0, 0, 0, 0)); | 135 x2, y2, x2, y2, 1, gfx::RectF(0, 0, 0, 0)); |
136 EXPECT_TRUE(selector_->OnGestureEvent(double_tap)); | 136 EXPECT_TRUE(selector_->OnGestureEvent(double_tap)); |
137 EXPECT_TRUE(event_log_.empty()); | 137 EXPECT_TRUE(event_log_.empty()); |
138 | 138 |
139 // 4. ET_GESTURE_SCROLL_BEGIN | 139 // 4. ET_GESTURE_SCROLL_BEGIN |
140 event_time += base::TimeDelta::FromMilliseconds(10); | 140 event_time += base::TimeDelta::FromMilliseconds(10); |
141 const GestureEventData scroll_begin( | 141 const GestureEventData scroll_begin( |
142 GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0, 0), 0, event_time, | 142 GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0, 0), 0, event_time, |
143 x1, y1, x1, y1, 1, gfx::RectF(0, 0, 0, 0)); | 143 x1, y1, x1, y1, 1, gfx::RectF(0, 0, 0, 0)); |
144 EXPECT_TRUE(selector_->OnGestureEvent(scroll_begin)); | 144 EXPECT_TRUE(selector_->OnGestureEvent(scroll_begin)); |
145 EXPECT_EQ(2u, event_log_.size()); // Unselect, Show | 145 EXPECT_EQ(1u, event_log_.size()); // Unselect |
146 EXPECT_STREQ("Show", event_log_.back().c_str()); | |
147 | 146 |
148 // 5. ET_GESTURE_SCROLL_UPDATE | 147 // 5. ET_GESTURE_SCROLL_UPDATE |
149 event_time += base::TimeDelta::FromMilliseconds(10); | 148 event_time += base::TimeDelta::FromMilliseconds(10); |
150 const GestureEventData scroll_update( | 149 const GestureEventData scroll_update( |
151 GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, 0, 0), 0, event_time, | 150 GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, 0, 0), 0, event_time, |
152 x2, y2, x2, y2, 1, gfx::RectF(0, 0, 0, 0)); | 151 x2, y2, x2, y2, 1, gfx::RectF(0, 0, 0, 0)); |
153 EXPECT_TRUE(selector_->OnGestureEvent(scroll_update)); | 152 EXPECT_TRUE(selector_->OnGestureEvent(scroll_update)); |
154 EXPECT_EQ(3u, event_log_.size()); // Unselect, Show, SelectRange | 153 EXPECT_EQ(3u, event_log_.size()); // Unselect, Show, SelectRange |
155 EXPECT_STREQ("SelectRange", event_log_.back().c_str()); | 154 EXPECT_STREQ("SelectRange", event_log_.back().c_str()); |
156 | 155 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 action_up.SetButtonState(0); | 207 action_up.SetButtonState(0); |
209 EXPECT_TRUE(selector_->OnTouchEvent(action_up)); | 208 EXPECT_TRUE(selector_->OnTouchEvent(action_up)); |
210 EXPECT_TRUE(event_log_.empty()); | 209 EXPECT_TRUE(event_log_.empty()); |
211 | 210 |
212 // 4. TAP | 211 // 4. TAP |
213 event_time += base::TimeDelta::FromMilliseconds(10); | 212 event_time += base::TimeDelta::FromMilliseconds(10); |
214 const GestureEventData tap( | 213 const GestureEventData tap( |
215 GestureEventDetails(ui::ET_GESTURE_TAP, 0, 0), 0, event_time, | 214 GestureEventDetails(ui::ET_GESTURE_TAP, 0, 0), 0, event_time, |
216 x1, y1, x1, y1, 1, gfx::RectF(0, 0, 0, 0)); | 215 x1, y1, x1, y1, 1, gfx::RectF(0, 0, 0, 0)); |
217 EXPECT_TRUE(selector_->OnGestureEvent(tap)); | 216 EXPECT_TRUE(selector_->OnGestureEvent(tap)); |
218 EXPECT_EQ(1u, event_log_.size()); // Unselect, Show | 217 EXPECT_EQ(1u, event_log_.size()); // LongPress |
219 EXPECT_STREQ("LongPress", event_log_.back().c_str()); | 218 EXPECT_STREQ("LongPress", event_log_.back().c_str()); |
220 } | 219 } |
221 | 220 |
222 } // namespace content | 221 } // namespace content |
OLD | NEW |