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

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: Added unit test 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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