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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 120503005: Merge NativeTextfieldViews into views::Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix touch drag and drop unit test. Created 6 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 | Annotate | Revision Log
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 "ash/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 #include "ash/display/display_manager.h" 6 #include "ash/display/display_manager.h"
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 aura::client::GetFocusClient(root_windows[0]); 773 aura::client::GetFocusClient(root_windows[0]);
774 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 774 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
775 775
776 // The lock window should get events on both root windows. 776 // The lock window should get events on both root windows.
777 aura::test::EventGenerator& event_generator(GetEventGenerator()); 777 aura::test::EventGenerator& event_generator(GetEventGenerator());
778 778
779 event_generator.set_current_root_window(root_windows[0]->GetDispatcher()); 779 event_generator.set_current_root_window(root_windows[0]->GetDispatcher());
780 event_generator.PressKey(ui::VKEY_A, 0); 780 event_generator.PressKey(ui::VKEY_A, 0);
781 event_generator.ReleaseKey(ui::VKEY_A, 0); 781 event_generator.ReleaseKey(ui::VKEY_A, 0);
782 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 782 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
783 EXPECT_EQ("a", UTF16ToASCII(textfield->text())); 783 EXPECT_EQ("a", UTF16ToASCII(textfield->GetText()));
784 784
785 event_generator.set_current_root_window(root_windows[1]->GetDispatcher()); 785 event_generator.set_current_root_window(root_windows[1]->GetDispatcher());
786 event_generator.PressKey(ui::VKEY_B, 0); 786 event_generator.PressKey(ui::VKEY_B, 0);
787 event_generator.ReleaseKey(ui::VKEY_B, 0); 787 event_generator.ReleaseKey(ui::VKEY_B, 0);
788 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 788 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
789 EXPECT_EQ("ab", UTF16ToASCII(textfield->text())); 789 EXPECT_EQ("ab", UTF16ToASCII(textfield->GetText()));
790 790
791 // Deleting 2nd display. The lock window still should get the events. 791 // Deleting 2nd display. The lock window still should get the events.
792 UpdateDisplay("100x100"); 792 UpdateDisplay("100x100");
793 event_generator.PressKey(ui::VKEY_C, 0); 793 event_generator.PressKey(ui::VKEY_C, 0);
794 event_generator.ReleaseKey(ui::VKEY_C, 0); 794 event_generator.ReleaseKey(ui::VKEY_C, 0);
795 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 795 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
796 EXPECT_EQ("abc", UTF16ToASCII(textfield->text())); 796 EXPECT_EQ("abc", UTF16ToASCII(textfield->GetText()));
797 797
798 // Creating 2nd display again, and lock window still should get events 798 // Creating 2nd display again, and lock window still should get events
799 // on both root windows. 799 // on both root windows.
800 UpdateDisplay("100x100,200x200"); 800 UpdateDisplay("100x100,200x200");
801 root_windows = Shell::GetAllRootWindows(); 801 root_windows = Shell::GetAllRootWindows();
802 event_generator.set_current_root_window(root_windows[0]->GetDispatcher()); 802 event_generator.set_current_root_window(root_windows[0]->GetDispatcher());
803 event_generator.PressKey(ui::VKEY_D, 0); 803 event_generator.PressKey(ui::VKEY_D, 0);
804 event_generator.ReleaseKey(ui::VKEY_D, 0); 804 event_generator.ReleaseKey(ui::VKEY_D, 0);
805 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 805 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
806 EXPECT_EQ("abcd", UTF16ToASCII(textfield->text())); 806 EXPECT_EQ("abcd", UTF16ToASCII(textfield->GetText()));
807 807
808 event_generator.set_current_root_window(root_windows[1]->GetDispatcher()); 808 event_generator.set_current_root_window(root_windows[1]->GetDispatcher());
809 event_generator.PressKey(ui::VKEY_E, 0); 809 event_generator.PressKey(ui::VKEY_E, 0);
810 event_generator.ReleaseKey(ui::VKEY_E, 0); 810 event_generator.ReleaseKey(ui::VKEY_E, 0);
811 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 811 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
812 EXPECT_EQ("abcde", UTF16ToASCII(textfield->text())); 812 EXPECT_EQ("abcde", UTF16ToASCII(textfield->GetText()));
813 } 813 }
814 814
815 TEST_F(ExtendedDesktopTest, PassiveGrab) { 815 TEST_F(ExtendedDesktopTest, PassiveGrab) {
816 if (!SupportsMultipleDisplays()) 816 if (!SupportsMultipleDisplays())
817 return; 817 return;
818 818
819 EventLocationRecordingEventHandler event_handler; 819 EventLocationRecordingEventHandler event_handler;
820 ash::Shell::GetInstance()->AddPreTargetHandler(&event_handler); 820 ash::Shell::GetInstance()->AddPreTargetHandler(&event_handler);
821 821
822 UpdateDisplay("300x300,200x200"); 822 UpdateDisplay("300x300,200x200");
(...skipping 14 matching lines...) Expand all
837 generator.ReleaseLeftButton(); 837 generator.ReleaseLeftButton();
838 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); 838 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset());
839 839
840 generator.MoveMouseTo(400, 150); 840 generator.MoveMouseTo(400, 150);
841 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); 841 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset());
842 842
843 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 843 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
844 } 844 }
845 845
846 } // namespace ash 846 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/options/passphrase_textfield.cc » ('j') | ui/views/controls/textfield/textfield.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698