Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: content/browser/renderer_host/input/touch_selection_controller_unittest.cc

Issue 482723002: Do not hide the selection handles on tap event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased my patch Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/input/touch_selection_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 EXPECT_FALSE(GetAndResetNeedsAnimate()); 645 EXPECT_FALSE(GetAndResetNeedsAnimate());
646 646
647 visible = true; 647 visible = true;
648 ChangeInsertion(insertion_rect, visible); 648 ChangeInsertion(insertion_rect, visible);
649 EXPECT_FALSE(GetAndResetNeedsAnimate()); 649 EXPECT_FALSE(GetAndResetNeedsAnimate());
650 650
651 controller().SetTemporarilyHidden(false); 651 controller().SetTemporarilyHidden(false);
652 EXPECT_TRUE(GetAndResetNeedsAnimate()); 652 EXPECT_TRUE(GetAndResetNeedsAnimate());
653 } 653 }
654 654
655 TEST_F(TouchSelectionControllerTest, SelectionClearOnTap) {
656 gfx::RectF start_rect(5, 5, 0, 10);
657 gfx::RectF end_rect(50, 5, 0, 10);
658 bool visible = true;
659
660 controller().OnLongPressEvent();
661 ChangeSelection(start_rect, visible, end_rect, visible);
662
663 // Selection should not be cleared if the selection bounds have not changed.
664 controller().OnTapEvent();
665 EXPECT_EQ(SELECTION_SHOWN, GetLastEventType());
666 EXPECT_EQ(start_rect.bottom_left(), GetLastEventAnchor());
667
668 controller().OnTapEvent();
669 ClearSelection();
670 EXPECT_EQ(SELECTION_CLEARED, GetLastEventType());
671 EXPECT_EQ(gfx::PointF(), GetLastEventAnchor());
672 }
673
655 } // namespace content 674 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/touch_selection_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698