Chromium Code Reviews| 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 "content/browser/renderer_host/input/touch_selection_controller.h" | 5 #include "content/browser/renderer_host/input/touch_selection_controller.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/events/test/mock_motion_event.h" | 8 #include "ui/events/test/mock_motion_event.h" |
| 9 | 9 |
| 10 using ui::test::MockMotionEvent; | 10 using ui::test::MockMotionEvent; |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 EXPECT_FALSE(GetAndResetNeedsAnimate()); | 641 EXPECT_FALSE(GetAndResetNeedsAnimate()); |
| 642 | 642 |
| 643 visible = true; | 643 visible = true; |
| 644 ChangeInsertion(insertion_rect, visible); | 644 ChangeInsertion(insertion_rect, visible); |
| 645 EXPECT_FALSE(GetAndResetNeedsAnimate()); | 645 EXPECT_FALSE(GetAndResetNeedsAnimate()); |
| 646 | 646 |
| 647 controller().SetTemporarilyHidden(false); | 647 controller().SetTemporarilyHidden(false); |
| 648 EXPECT_TRUE(GetAndResetNeedsAnimate()); | 648 EXPECT_TRUE(GetAndResetNeedsAnimate()); |
| 649 } | 649 } |
| 650 | 650 |
| 651 TEST_F(TouchSelectionControllerTest, SelectionClearOnTap) { | |
| 652 gfx::RectF start_rect(5, 5, 0, 10); | |
| 653 gfx::RectF end_rect(50, 5, 0, 10); | |
| 654 bool visible = true; | |
| 655 | |
| 656 controller().OnLongPressEvent(); | |
| 657 ChangeSelection(start_rect, visible, end_rect, visible); | |
| 658 | |
| 659 // Selection should not be cleared if the selection bounds have not changed | |
|
jdduke (slow)
2014/08/20 01:50:53
Nit: period at end of comments (line break if nece
raghu
2014/08/20 05:02:10
Done.
| |
| 660 controller().OnTapEvent(); | |
| 661 EXPECT_EQ(SELECTION_SHOWN, GetLastEventType()); | |
| 662 EXPECT_EQ(start_rect.bottom_left(), GetLastEventAnchor()); | |
| 663 | |
| 664 controller().OnTapEvent(); | |
| 665 ClearSelection(); | |
| 666 EXPECT_EQ(SELECTION_CLEARED, GetLastEventType()); | |
| 667 EXPECT_EQ(gfx::PointF(), GetLastEventAnchor()); | |
| 668 } | |
| 669 | |
| 651 } // namespace content | 670 } // namespace content |
| OLD | NEW |