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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 184903003: Window ownership -> WindowTreeHost (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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_util.h" 8 #include "ash/screen_util.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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); 245 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
246 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow()); 246 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow());
247 } 247 }
248 248
249 TEST_F(ExtendedDesktopTest, TestCursor) { 249 TEST_F(ExtendedDesktopTest, TestCursor) {
250 if (!SupportsMultipleDisplays()) 250 if (!SupportsMultipleDisplays())
251 return; 251 return;
252 252
253 UpdateDisplay("1000x600,600x400"); 253 UpdateDisplay("1000x600,600x400");
254 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 254 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
255 aura::WindowEventDispatcher* dispatcher0 = root_windows[0]->GetDispatcher(); 255 aura::WindowTreeHost* host0 = root_windows[0]->GetHost();
256 aura::WindowEventDispatcher* dispatcher1 = root_windows[1]->GetDispatcher(); 256 aura::WindowTreeHost* host1 = root_windows[1]->GetHost();
257 EXPECT_EQ(ui::kCursorPointer, 257 EXPECT_EQ(ui::kCursorPointer, host0->last_cursor().native_type());
258 dispatcher0->host()->last_cursor().native_type()); 258 EXPECT_EQ(ui::kCursorPointer, host1->last_cursor().native_type());
259 EXPECT_EQ(ui::kCursorPointer,
260 dispatcher1->host()->last_cursor().native_type());
261 Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorCopy); 259 Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorCopy);
262 EXPECT_EQ(ui::kCursorCopy, dispatcher0->host()->last_cursor().native_type()); 260 EXPECT_EQ(ui::kCursorCopy, host0->last_cursor().native_type());
263 EXPECT_EQ(ui::kCursorCopy, dispatcher1->host()->last_cursor().native_type()); 261 EXPECT_EQ(ui::kCursorCopy, host1->last_cursor().native_type());
264 } 262 }
265 263
266 TEST_F(ExtendedDesktopTest, TestCursorLocation) { 264 TEST_F(ExtendedDesktopTest, TestCursorLocation) {
267 if (!SupportsMultipleDisplays()) 265 if (!SupportsMultipleDisplays())
268 return; 266 return;
269 267
270 UpdateDisplay("1000x600,600x400"); 268 UpdateDisplay("1000x600,600x400");
271 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 269 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
272 aura::test::WindowTestApi root_window0_test_api(root_windows[0]); 270 aura::test::WindowTestApi root_window0_test_api(root_windows[0]);
273 aura::test::WindowTestApi root_window1_test_api(root_windows[1]); 271 aura::test::WindowTestApi root_window1_test_api(root_windows[1]);
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 lock_widget->Show(); 781 lock_widget->Show();
784 textfield->RequestFocus(); 782 textfield->RequestFocus();
785 783
786 aura::client::FocusClient* focus_client = 784 aura::client::FocusClient* focus_client =
787 aura::client::GetFocusClient(root_windows[0]); 785 aura::client::GetFocusClient(root_windows[0]);
788 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 786 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
789 787
790 // The lock window should get events on both root windows. 788 // The lock window should get events on both root windows.
791 aura::test::EventGenerator& event_generator(GetEventGenerator()); 789 aura::test::EventGenerator& event_generator(GetEventGenerator());
792 790
793 event_generator.set_current_dispatcher(root_windows[0]->GetDispatcher()); 791 event_generator.set_current_dispatcher(
792 root_windows[0]->GetHost()->dispatcher());
794 event_generator.PressKey(ui::VKEY_A, 0); 793 event_generator.PressKey(ui::VKEY_A, 0);
795 event_generator.ReleaseKey(ui::VKEY_A, 0); 794 event_generator.ReleaseKey(ui::VKEY_A, 0);
796 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 795 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
797 EXPECT_EQ("a", UTF16ToASCII(textfield->text())); 796 EXPECT_EQ("a", UTF16ToASCII(textfield->text()));
798 797
799 event_generator.set_current_dispatcher(root_windows[1]->GetDispatcher()); 798 event_generator.set_current_dispatcher(
799 root_windows[1]->GetHost()->dispatcher());
800 event_generator.PressKey(ui::VKEY_B, 0); 800 event_generator.PressKey(ui::VKEY_B, 0);
801 event_generator.ReleaseKey(ui::VKEY_B, 0); 801 event_generator.ReleaseKey(ui::VKEY_B, 0);
802 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 802 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
803 EXPECT_EQ("ab", UTF16ToASCII(textfield->text())); 803 EXPECT_EQ("ab", UTF16ToASCII(textfield->text()));
804 804
805 // Deleting 2nd display. The lock window still should get the events. 805 // Deleting 2nd display. The lock window still should get the events.
806 UpdateDisplay("100x100"); 806 UpdateDisplay("100x100");
807 event_generator.PressKey(ui::VKEY_C, 0); 807 event_generator.PressKey(ui::VKEY_C, 0);
808 event_generator.ReleaseKey(ui::VKEY_C, 0); 808 event_generator.ReleaseKey(ui::VKEY_C, 0);
809 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 809 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
810 EXPECT_EQ("abc", UTF16ToASCII(textfield->text())); 810 EXPECT_EQ("abc", UTF16ToASCII(textfield->text()));
811 811
812 // Creating 2nd display again, and lock window still should get events 812 // Creating 2nd display again, and lock window still should get events
813 // on both root windows. 813 // on both root windows.
814 UpdateDisplay("100x100,200x200"); 814 UpdateDisplay("100x100,200x200");
815 root_windows = Shell::GetAllRootWindows(); 815 root_windows = Shell::GetAllRootWindows();
816 event_generator.set_current_dispatcher(root_windows[0]->GetDispatcher()); 816 event_generator.set_current_dispatcher(
817 root_windows[0]->GetHost()->dispatcher());
817 event_generator.PressKey(ui::VKEY_D, 0); 818 event_generator.PressKey(ui::VKEY_D, 0);
818 event_generator.ReleaseKey(ui::VKEY_D, 0); 819 event_generator.ReleaseKey(ui::VKEY_D, 0);
819 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 820 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
820 EXPECT_EQ("abcd", UTF16ToASCII(textfield->text())); 821 EXPECT_EQ("abcd", UTF16ToASCII(textfield->text()));
821 822
822 event_generator.set_current_dispatcher(root_windows[1]->GetDispatcher()); 823 event_generator.set_current_dispatcher(
824 root_windows[1]->GetHost()->dispatcher());
823 event_generator.PressKey(ui::VKEY_E, 0); 825 event_generator.PressKey(ui::VKEY_E, 0);
824 event_generator.ReleaseKey(ui::VKEY_E, 0); 826 event_generator.ReleaseKey(ui::VKEY_E, 0);
825 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 827 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
826 EXPECT_EQ("abcde", UTF16ToASCII(textfield->text())); 828 EXPECT_EQ("abcde", UTF16ToASCII(textfield->text()));
827 } 829 }
828 830
829 TEST_F(ExtendedDesktopTest, PassiveGrab) { 831 TEST_F(ExtendedDesktopTest, PassiveGrab) {
830 if (!SupportsMultipleDisplays()) 832 if (!SupportsMultipleDisplays())
831 return; 833 return;
832 834
(...skipping 18 matching lines...) Expand all
851 generator.ReleaseLeftButton(); 853 generator.ReleaseLeftButton();
852 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); 854 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset());
853 855
854 generator.MoveMouseTo(400, 150); 856 generator.MoveMouseTo(400, 150);
855 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); 857 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset());
856 858
857 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 859 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
858 } 860 }
859 861
860 } // namespace ash 862 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_controller_unittest.cc ('k') | ash/magnifier/magnification_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698