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

Side by Side Diff: ui/views/touchui/touch_selection_controller_impl_unittest.cc

Issue 2611773002: Removes code using mus client lib (Closed)
Patch Set: dont run on linux Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/aura/client/screen_position_client.h" 10 #include "ui/aura/client/screen_position_client.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 ~TouchSelectionControllerImplTest() override { 72 ~TouchSelectionControllerImplTest() override {
73 ui::TouchEditingControllerFactory::SetInstance(nullptr); 73 ui::TouchEditingControllerFactory::SetInstance(nullptr);
74 } 74 }
75 75
76 void SetUp() override { 76 void SetUp() override {
77 ViewsTestBase::SetUp(); 77 ViewsTestBase::SetUp();
78 // TODO: test uses GetContext(), which is not applicable to aura-mus. 78 // TODO: test uses GetContext(), which is not applicable to aura-mus.
79 // http://crbug.com/663809. 79 // http://crbug.com/663809.
80 if (IsAuraMusClient()) 80 if (IsMus())
81 return; 81 return;
82 test_cursor_client_.reset(new aura::test::TestCursorClient(GetContext())); 82 test_cursor_client_.reset(new aura::test::TestCursorClient(GetContext()));
83 } 83 }
84 84
85 void TearDown() override { 85 void TearDown() override {
86 test_cursor_client_.reset(); 86 test_cursor_client_.reset();
87 if (textfield_widget_ && !textfield_widget_->IsClosed()) 87 if (textfield_widget_ && !textfield_widget_->IsClosed())
88 textfield_widget_->Close(); 88 textfield_widget_->Close();
89 if (widget_ && !widget_->IsClosed()) 89 if (widget_ && !widget_->IsClosed())
90 widget_->Close(); 90 widget_->Close();
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 std::unique_ptr<aura::test::TestCursorClient> test_cursor_client_; 316 std::unique_ptr<aura::test::TestCursorClient> test_cursor_client_;
317 317
318 private: 318 private:
319 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImplTest); 319 DISALLOW_COPY_AND_ASSIGN(TouchSelectionControllerImplTest);
320 }; 320 };
321 321
322 // Tests that the selection handles are placed appropriately when selection in 322 // Tests that the selection handles are placed appropriately when selection in
323 // a Textfield changes. 323 // a Textfield changes.
324 TEST_F(TouchSelectionControllerImplTest, SelectionInTextfieldTest) { 324 TEST_F(TouchSelectionControllerImplTest, SelectionInTextfieldTest) {
325 // TODO: see comment in SetUp(). 325 // TODO: see comment in SetUp().
326 if (IsAuraMusClient()) 326 if (IsMus())
327 return; 327 return;
328 328
329 CreateTextfield(); 329 CreateTextfield();
330 textfield_->SetText(ASCIIToUTF16("some text")); 330 textfield_->SetText(ASCIIToUTF16("some text"));
331 // Tap the textfield to invoke touch selection. 331 // Tap the textfield to invoke touch selection.
332 ui::GestureEventDetails details(ui::ET_GESTURE_TAP); 332 ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
333 details.set_tap_count(1); 333 details.set_tap_count(1);
334 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), details); 334 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), details);
335 textfield_->OnGestureEvent(&tap); 335 textfield_->OnGestureEvent(&tap);
336 336
(...skipping 16 matching lines...) Expand all
353 // Test with focus re-gained. 353 // Test with focus re-gained.
354 textfield_widget_->GetFocusManager()->SetFocusedView(textfield_); 354 textfield_widget_->GetFocusManager()->SetFocusedView(textfield_);
355 EXPECT_FALSE(GetSelectionController()); 355 EXPECT_FALSE(GetSelectionController());
356 textfield_->OnGestureEvent(&tap); 356 textfield_->OnGestureEvent(&tap);
357 VerifyHandlePositions(false, true, FROM_HERE); 357 VerifyHandlePositions(false, true, FROM_HERE);
358 } 358 }
359 359
360 // Tests that the selection handles are placed appropriately in bidi text. 360 // Tests that the selection handles are placed appropriately in bidi text.
361 TEST_F(TouchSelectionControllerImplTest, SelectionInBidiTextfieldTest) { 361 TEST_F(TouchSelectionControllerImplTest, SelectionInBidiTextfieldTest) {
362 // TODO: see comment in SetUp(). 362 // TODO: see comment in SetUp().
363 if (IsAuraMusClient()) 363 if (IsMus())
364 return; 364 return;
365 365
366 CreateTextfield(); 366 CreateTextfield();
367 textfield_->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2")); 367 textfield_->SetText(WideToUTF16(L"abc\x05d0\x05d1\x05d2"));
368 // Tap the textfield to invoke touch selection. 368 // Tap the textfield to invoke touch selection.
369 ui::GestureEventDetails details(ui::ET_GESTURE_TAP); 369 ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
370 details.set_tap_count(1); 370 details.set_tap_count(1);
371 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), details); 371 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), details);
372 textfield_->OnGestureEvent(&tap); 372 textfield_->OnGestureEvent(&tap);
373 373
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 VerifyHandlePositions(false, true, FROM_HERE); 409 VerifyHandlePositions(false, true, FROM_HERE);
410 410
411 textfield_->SelectRange(gfx::Range(4, 1)); 411 textfield_->SelectRange(gfx::Range(4, 1));
412 VerifyHandlePositions(false, true, FROM_HERE); 412 VerifyHandlePositions(false, true, FROM_HERE);
413 } 413 }
414 414
415 // Tests if the SelectRect callback is called appropriately when selection 415 // Tests if the SelectRect callback is called appropriately when selection
416 // handles are moved. 416 // handles are moved.
417 TEST_F(TouchSelectionControllerImplTest, SelectRectCallbackTest) { 417 TEST_F(TouchSelectionControllerImplTest, SelectRectCallbackTest) {
418 // TODO: see comment in SetUp(). 418 // TODO: see comment in SetUp().
419 if (IsAuraMusClient()) 419 if (IsMus())
420 return; 420 return;
421 421
422 CreateTextfield(); 422 CreateTextfield();
423 textfield_->SetText(ASCIIToUTF16("textfield with selected text")); 423 textfield_->SetText(ASCIIToUTF16("textfield with selected text"));
424 // Tap the textfield to invoke touch selection. 424 // Tap the textfield to invoke touch selection.
425 ui::GestureEventDetails details(ui::ET_GESTURE_TAP); 425 ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
426 details.set_tap_count(1); 426 details.set_tap_count(1);
427 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), details); 427 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), details);
428 textfield_->OnGestureEvent(&tap); 428 textfield_->OnGestureEvent(&tap);
429 textfield_->SelectRange(gfx::Range(3, 7)); 429 textfield_->SelectRange(gfx::Range(3, 7));
(...skipping 25 matching lines...) Expand all
455 455
456 // Drag selection handle 2 across selection handle 1. 456 // Drag selection handle 2 across selection handle 1.
457 x = gfx::Canvas::GetStringWidth(ASCIIToUTF16("with selected "), font_list); 457 x = gfx::Canvas::GetStringWidth(ASCIIToUTF16("with selected "), font_list);
458 SimulateSelectionHandleDrag(gfx::Vector2d(x, 0), 2); 458 SimulateSelectionHandleDrag(gfx::Vector2d(x, 0), 2);
459 EXPECT_EQ("selected ", UTF16ToUTF8(textfield_->GetSelectedText())); 459 EXPECT_EQ("selected ", UTF16ToUTF8(textfield_->GetSelectedText()));
460 VerifyHandlePositions(false, true, FROM_HERE); 460 VerifyHandlePositions(false, true, FROM_HERE);
461 } 461 }
462 462
463 TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) { 463 TEST_F(TouchSelectionControllerImplTest, SelectRectInBidiCallbackTest) {
464 // TODO: see comment in SetUp(). 464 // TODO: see comment in SetUp().
465 if (IsAuraMusClient()) 465 if (IsMus())
466 return; 466 return;
467 467
468 CreateTextfield(); 468 CreateTextfield();
469 textfield_->SetText(WideToUTF16(L"abc\x05e1\x05e2\x05e3" L"def")); 469 textfield_->SetText(WideToUTF16(L"abc\x05e1\x05e2\x05e3" L"def"));
470 // Tap the textfield to invoke touch selection. 470 // Tap the textfield to invoke touch selection.
471 ui::GestureEventDetails details(ui::ET_GESTURE_TAP); 471 ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
472 details.set_tap_count(1); 472 details.set_tap_count(1);
473 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), details); 473 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), details);
474 textfield_->OnGestureEvent(&tap); 474 textfield_->OnGestureEvent(&tap);
475 475
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 // Drag selection handle 2 to right by 1 char. 587 // Drag selection handle 2 to right by 1 char.
588 x = gfx::Canvas::GetStringWidth(WideToUTF16(L"\x05e2"), font_list); 588 x = gfx::Canvas::GetStringWidth(WideToUTF16(L"\x05e2"), font_list);
589 SimulateSelectionHandleDrag(gfx::Vector2d(x, 0), 2); 589 SimulateSelectionHandleDrag(gfx::Vector2d(x, 0), 2);
590 EXPECT_EQ(WideToUTF16(L"c\x05e1"), textfield_->GetSelectedText()); 590 EXPECT_EQ(WideToUTF16(L"c\x05e1"), textfield_->GetSelectedText());
591 VerifyHandlePositions(false, false, FROM_HERE); 591 VerifyHandlePositions(false, false, FROM_HERE);
592 } 592 }
593 593
594 TEST_F(TouchSelectionControllerImplTest, 594 TEST_F(TouchSelectionControllerImplTest,
595 HiddenSelectionHandleRetainsCursorPosition) { 595 HiddenSelectionHandleRetainsCursorPosition) {
596 // TODO: see comment in SetUp(). 596 // TODO: see comment in SetUp().
597 if (IsAuraMusClient()) 597 if (IsMus())
598 return; 598 return;
599 599
600 static const uint32_t selection_start = 10u; 600 static const uint32_t selection_start = 10u;
601 SetupSelectionInvisibleHandle(selection_start); 601 SetupSelectionInvisibleHandle(selection_start);
602 // Drag the visible handle around and make sure the selection end point of the 602 // Drag the visible handle around and make sure the selection end point of the
603 // invisible handle does not change. 603 // invisible handle does not change.
604 size_t visible_handle_position = textfield_->GetSelectedRange().end(); 604 size_t visible_handle_position = textfield_->GetSelectedRange().end();
605 for (int i = 0; i < 10; ++i) { 605 for (int i = 0; i < 10; ++i) {
606 static const int drag_diff = -10; 606 static const int drag_diff = -10;
607 SimulateSelectionHandleDrag(gfx::Vector2d(drag_diff, 0), 2); 607 SimulateSelectionHandleDrag(gfx::Vector2d(drag_diff, 0), 2);
608 // Make sure that the visible handle is being dragged. 608 // Make sure that the visible handle is being dragged.
609 EXPECT_NE(visible_handle_position, textfield_->GetSelectedRange().end()); 609 EXPECT_NE(visible_handle_position, textfield_->GetSelectedRange().end());
610 visible_handle_position = textfield_->GetSelectedRange().end(); 610 visible_handle_position = textfield_->GetSelectedRange().end();
611 EXPECT_EQ((size_t) 10, textfield_->GetSelectedRange().start()); 611 EXPECT_EQ((size_t) 10, textfield_->GetSelectedRange().start());
612 } 612 }
613 } 613 }
614 614
615 // Tests that we can handle the hidden handle getting exposed as a result of a 615 // Tests that we can handle the hidden handle getting exposed as a result of a
616 // drag and that it maintains the correct orientation when exposed. 616 // drag and that it maintains the correct orientation when exposed.
617 TEST_F(TouchSelectionControllerImplTest, HiddenSelectionHandleExposed) { 617 TEST_F(TouchSelectionControllerImplTest, HiddenSelectionHandleExposed) {
618 // TODO: see comment in SetUp(). 618 // TODO: see comment in SetUp().
619 if (IsAuraMusClient()) 619 if (IsMus())
620 return; 620 return;
621 621
622 static const uint32_t selection_start = 0u; 622 static const uint32_t selection_start = 0u;
623 SetupSelectionInvisibleHandle(selection_start); 623 SetupSelectionInvisibleHandle(selection_start);
624 624
625 // Drag the handle until the selection shrinks such that the other handle 625 // Drag the handle until the selection shrinks such that the other handle
626 // becomes visible. 626 // becomes visible.
627 while (!IsSelectionHandle1Visible()) { 627 while (!IsSelectionHandle1Visible()) {
628 static const int drag_diff = -10; 628 static const int drag_diff = -10;
629 SimulateSelectionHandleDrag(gfx::Vector2d(drag_diff, 0), 2); 629 SimulateSelectionHandleDrag(gfx::Vector2d(drag_diff, 0), 2);
630 } 630 }
631 631
632 // Confirm that the exposed handle maintains the LEFT orientation 632 // Confirm that the exposed handle maintains the LEFT orientation
633 // (and does not reset to gfx::SelectionBound::Type::CENTER). 633 // (and does not reset to gfx::SelectionBound::Type::CENTER).
634 EXPECT_EQ(gfx::SelectionBound::Type::LEFT, GetSelectionHandle1Type()); 634 EXPECT_EQ(gfx::SelectionBound::Type::LEFT, GetSelectionHandle1Type());
635 } 635 }
636 636
637 TEST_F(TouchSelectionControllerImplTest, 637 TEST_F(TouchSelectionControllerImplTest,
638 DoubleTapInTextfieldWithCursorHandleShouldSelectText) { 638 DoubleTapInTextfieldWithCursorHandleShouldSelectText) {
639 // TODO: see comment in SetUp(). 639 // TODO: see comment in SetUp().
640 if (IsAuraMusClient()) 640 if (IsMus())
641 return; 641 return;
642 642
643 CreateTextfield(); 643 CreateTextfield();
644 textfield_->SetText(ASCIIToUTF16("some text")); 644 textfield_->SetText(ASCIIToUTF16("some text"));
645 ui::test::EventGenerator generator( 645 ui::test::EventGenerator generator(
646 textfield_->GetWidget()->GetNativeView()->GetRootWindow()); 646 textfield_->GetWidget()->GetNativeView()->GetRootWindow());
647 647
648 // Tap the textfield to invoke touch selection. 648 // Tap the textfield to invoke touch selection.
649 generator.GestureTapAt(gfx::Point(10, 10)); 649 generator.GestureTapAt(gfx::Point(10, 10));
650 650
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 gfx::SelectionBound cursor_bound_; 733 gfx::SelectionBound cursor_bound_;
734 734
735 DISALLOW_COPY_AND_ASSIGN(TestTouchEditable); 735 DISALLOW_COPY_AND_ASSIGN(TestTouchEditable);
736 }; 736 };
737 737
738 // Tests if the touch editing handle is shown or hidden properly according to 738 // Tests if the touch editing handle is shown or hidden properly according to
739 // the cursor position relative to the client boundaries. 739 // the cursor position relative to the client boundaries.
740 TEST_F(TouchSelectionControllerImplTest, 740 TEST_F(TouchSelectionControllerImplTest,
741 VisibilityOfHandleRegardingClientBounds) { 741 VisibilityOfHandleRegardingClientBounds) {
742 // TODO: see comment in SetUp(). 742 // TODO: see comment in SetUp().
743 if (IsAuraMusClient()) 743 if (IsMus())
744 return; 744 return;
745 745
746 CreateWidget(); 746 CreateWidget();
747 747
748 TestTouchEditable touch_editable(widget_->GetNativeView()); 748 TestTouchEditable touch_editable(widget_->GetNativeView());
749 std::unique_ptr<ui::TouchEditingControllerDeprecated> 749 std::unique_ptr<ui::TouchEditingControllerDeprecated>
750 touch_selection_controller( 750 touch_selection_controller(
751 ui::TouchEditingControllerDeprecated::Create(&touch_editable)); 751 ui::TouchEditingControllerDeprecated::Create(&touch_editable));
752 752
753 touch_editable.set_bounds(gfx::Rect(0, 0, 100, 20)); 753 touch_editable.set_bounds(gfx::Rect(0, 0, 100, 20));
(...skipping 30 matching lines...) Expand all
784 touch_editable.set_cursor_rect( 784 touch_editable.set_cursor_rect(
785 gfx::RectF(2.f, kBarBottomAllowance + 1.f, 1.f, 20.f)); 785 gfx::RectF(2.f, kBarBottomAllowance + 1.f, 1.f, 20.f));
786 touch_selection_controller->SelectionChanged(); 786 touch_selection_controller->SelectionChanged();
787 EXPECT_FALSE(IsCursorHandleVisibleFor(touch_selection_controller.get())); 787 EXPECT_FALSE(IsCursorHandleVisibleFor(touch_selection_controller.get()));
788 788
789 touch_selection_controller.reset(); 789 touch_selection_controller.reset();
790 } 790 }
791 791
792 TEST_F(TouchSelectionControllerImplTest, HandlesStackAboveParent) { 792 TEST_F(TouchSelectionControllerImplTest, HandlesStackAboveParent) {
793 // TODO: see comment in SetUp(). 793 // TODO: see comment in SetUp().
794 if (IsAuraMusClient()) 794 if (IsMus())
795 return; 795 return;
796 796
797 ui::EventTarget* root = GetContext(); 797 ui::EventTarget* root = GetContext();
798 ui::EventTargeter* targeter = root->GetEventTargeter(); 798 ui::EventTargeter* targeter = root->GetEventTargeter();
799 799
800 // Create the first window containing a Views::Textfield. 800 // Create the first window containing a Views::Textfield.
801 CreateTextfield(); 801 CreateTextfield();
802 aura::Window* window1 = textfield_widget_->GetNativeView(); 802 aura::Window* window1 = textfield_widget_->GetNativeView();
803 803
804 // Start touch editing, check that the handle is above the first window, and 804 // Start touch editing, check that the handle is above the first window, and
(...skipping 21 matching lines...) Expand all
826 // first window. 826 // first window.
827 window1->GetRootWindow()->StackChildAtTop(window1); 827 window1->GetRootWindow()->StackChildAtTop(window1);
828 ui::MouseEvent test_event3(ui::ET_MOUSE_MOVED, test_point, test_point, 828 ui::MouseEvent test_event3(ui::ET_MOUSE_MOVED, test_point, test_point,
829 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); 829 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
830 EXPECT_EQ(GetCursorHandleNativeView(), 830 EXPECT_EQ(GetCursorHandleNativeView(),
831 targeter->FindTargetForEvent(root, &test_event3)); 831 targeter->FindTargetForEvent(root, &test_event3));
832 } 832 }
833 833
834 TEST_F(TouchSelectionControllerImplTest, MouseEventDeactivatesTouchSelection) { 834 TEST_F(TouchSelectionControllerImplTest, MouseEventDeactivatesTouchSelection) {
835 // TODO: see comment in SetUp(). 835 // TODO: see comment in SetUp().
836 if (IsAuraMusClient()) 836 if (IsMus())
837 return; 837 return;
838 838
839 CreateTextfield(); 839 CreateTextfield();
840 EXPECT_FALSE(GetSelectionController()); 840 EXPECT_FALSE(GetSelectionController());
841 841
842 ui::test::EventGenerator generator( 842 ui::test::EventGenerator generator(
843 textfield_widget_->GetNativeView()->GetRootWindow()); 843 textfield_widget_->GetNativeView()->GetRootWindow());
844 844
845 generator.set_current_location(gfx::Point(5, 5)); 845 generator.set_current_location(gfx::Point(5, 5));
846 RunPendingMessages(); 846 RunPendingMessages();
(...skipping 24 matching lines...) Expand all
871 // ensure it deactivates touch selection. 871 // ensure it deactivates touch selection.
872 StartTouchEditing(); 872 StartTouchEditing();
873 EXPECT_TRUE(GetSelectionController()); 873 EXPECT_TRUE(GetSelectionController());
874 generator.MoveMouseTo(5, 505); 874 generator.MoveMouseTo(5, 505);
875 RunPendingMessages(); 875 RunPendingMessages();
876 EXPECT_FALSE(GetSelectionController()); 876 EXPECT_FALSE(GetSelectionController());
877 } 877 }
878 878
879 TEST_F(TouchSelectionControllerImplTest, MouseCaptureChangedEventIgnored) { 879 TEST_F(TouchSelectionControllerImplTest, MouseCaptureChangedEventIgnored) {
880 // TODO: see comment in SetUp(). 880 // TODO: see comment in SetUp().
881 if (IsAuraMusClient()) 881 if (IsMus())
882 return; 882 return;
883 883
884 CreateTextfield(); 884 CreateTextfield();
885 EXPECT_FALSE(GetSelectionController()); 885 EXPECT_FALSE(GetSelectionController());
886 886
887 ui::test::EventGenerator generator( 887 ui::test::EventGenerator generator(
888 textfield_widget_->GetNativeView()->GetRootWindow()); 888 textfield_widget_->GetNativeView()->GetRootWindow());
889 RunPendingMessages(); 889 RunPendingMessages();
890 890
891 // Start touch editing; then generate a mouse-capture-changed event and ensure 891 // Start touch editing; then generate a mouse-capture-changed event and ensure
892 // it does not deactivate touch selection. 892 // it does not deactivate touch selection.
893 StartTouchEditing(); 893 StartTouchEditing();
894 EXPECT_TRUE(GetSelectionController()); 894 EXPECT_TRUE(GetSelectionController());
895 ui::MouseEvent capture_changed(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(5, 5), 895 ui::MouseEvent capture_changed(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(5, 5),
896 gfx::Point(5, 5), base::TimeTicks(), 0, 0); 896 gfx::Point(5, 5), base::TimeTicks(), 0, 0);
897 generator.Dispatch(&capture_changed); 897 generator.Dispatch(&capture_changed);
898 RunPendingMessages(); 898 RunPendingMessages();
899 EXPECT_TRUE(GetSelectionController()); 899 EXPECT_TRUE(GetSelectionController());
900 } 900 }
901 901
902 TEST_F(TouchSelectionControllerImplTest, KeyEventDeactivatesTouchSelection) { 902 TEST_F(TouchSelectionControllerImplTest, KeyEventDeactivatesTouchSelection) {
903 // TODO: see comment in SetUp(). 903 // TODO: see comment in SetUp().
904 if (IsAuraMusClient()) 904 if (IsMus())
905 return; 905 return;
906 906
907 CreateTextfield(); 907 CreateTextfield();
908 EXPECT_FALSE(GetSelectionController()); 908 EXPECT_FALSE(GetSelectionController());
909 909
910 ui::test::EventGenerator generator( 910 ui::test::EventGenerator generator(
911 textfield_widget_->GetNativeView()->GetRootWindow()); 911 textfield_widget_->GetNativeView()->GetRootWindow());
912 912
913 RunPendingMessages(); 913 RunPendingMessages();
914 914
915 // Start touch editing; then press a key and ensure it deactivates touch 915 // Start touch editing; then press a key and ensure it deactivates touch
916 // selection. 916 // selection.
917 StartTouchEditing(); 917 StartTouchEditing();
918 EXPECT_TRUE(GetSelectionController()); 918 EXPECT_TRUE(GetSelectionController());
919 generator.PressKey(ui::VKEY_A, 0); 919 generator.PressKey(ui::VKEY_A, 0);
920 RunPendingMessages(); 920 RunPendingMessages();
921 EXPECT_FALSE(GetSelectionController()); 921 EXPECT_FALSE(GetSelectionController());
922 } 922 }
923 923
924 } // namespace views 924 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/test/views_test_helper_aura.cc ('k') | ui/views/touchui/touch_selection_menu_runner_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698