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" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "ui/events/event_constants.h" | 12 #include "ui/events/event_constants.h" |
13 #include "ui/events/gesture_detection/motion_event.h" | 13 #include "ui/events/gesture_detection/motion_event.h" |
14 #include "ui/events/test/mock_motion_event.h" | 14 #include "ui/events/test/motion_event_test_utils.h" |
15 #include "ui/gfx/geometry/rect_f.h" | 15 #include "ui/gfx/geometry/rect_f.h" |
16 | 16 |
17 using ui::MotionEvent; | 17 using ui::MotionEvent; |
18 using ui::test::MockMotionEvent; | 18 using ui::test::MockMotionEvent; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class GestureTextSelectorTest : public testing::Test, | 22 class GestureTextSelectorTest : public testing::Test, |
23 public GestureTextSelectorClient { | 23 public GestureTextSelectorClient { |
24 public: | 24 public: |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 event_time += base::TimeDelta::FromMilliseconds(1); | 214 event_time += base::TimeDelta::FromMilliseconds(1); |
215 MockMotionEvent action_up(MotionEvent::ACTION_UP, event_time, x2, y2); | 215 MockMotionEvent action_up(MotionEvent::ACTION_UP, event_time, x2, y2); |
216 action_up.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS); | 216 action_up.SetToolType(0, MotionEvent::TOOL_TYPE_STYLUS); |
217 action_up.set_button_state(0); | 217 action_up.set_button_state(0); |
218 EXPECT_TRUE(selector_->OnTouchEvent(action_up)); | 218 EXPECT_TRUE(selector_->OnTouchEvent(action_up)); |
219 ASSERT_EQ(1u, event_log_.size()); | 219 ASSERT_EQ(1u, event_log_.size()); |
220 EXPECT_STREQ("LongPress", event_log_.back().c_str()); | 220 EXPECT_STREQ("LongPress", event_log_.back().c_str()); |
221 } | 221 } |
222 | 222 |
223 } // namespace content | 223 } // namespace content |
OLD | NEW |