| OLD | NEW |
| 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/aura/wm_window_aura.h" | 5 #include "ash/aura/wm_window_aura.h" |
| 6 #include "ash/common/shell_window_ids.h" | 6 #include "ash/common/shell_window_ids.h" |
| 7 #include "ash/common/wm/root_window_finder.h" | 7 #include "ash/common/wm/root_window_finder.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 aura::Window* target_; | 77 aura::Window* target_; |
| 78 DISALLOW_COPY_AND_ASSIGN(MoveWindowByClickEventHandler); | 78 DISALLOW_COPY_AND_ASSIGN(MoveWindowByClickEventHandler); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // An event handler which records the event's locations. | 81 // An event handler which records the event's locations. |
| 82 class EventLocationRecordingEventHandler : public ui::EventHandler { | 82 class EventLocationRecordingEventHandler : public ui::EventHandler { |
| 83 public: | 83 public: |
| 84 explicit EventLocationRecordingEventHandler() { | 84 explicit EventLocationRecordingEventHandler() { reset(); } |
| 85 reset(); | |
| 86 } | |
| 87 ~EventLocationRecordingEventHandler() override {} | 85 ~EventLocationRecordingEventHandler() override {} |
| 88 | 86 |
| 89 std::string GetLocationsAndReset() { | 87 std::string GetLocationsAndReset() { |
| 90 std::string result = | 88 std::string result = location_.ToString() + " " + root_location_.ToString(); |
| 91 location_.ToString() + " " + root_location_.ToString(); | |
| 92 reset(); | 89 reset(); |
| 93 return result; | 90 return result; |
| 94 } | 91 } |
| 95 | 92 |
| 96 private: | 93 private: |
| 97 // ui::EventHandler overrides: | 94 // ui::EventHandler overrides: |
| 98 void OnMouseEvent(ui::MouseEvent* event) override { | 95 void OnMouseEvent(ui::MouseEvent* event) override { |
| 99 if (event->type() == ui::ET_MOUSE_MOVED || | 96 if (event->type() == ui::ET_MOUSE_MOVED || |
| 100 event->type() == ui::ET_MOUSE_DRAGGED) { | 97 event->type() == ui::ET_MOUSE_DRAGGED) { |
| 101 location_ = event->location(); | 98 location_ = event->location(); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 UpdateDisplay("1000x600,600x400"); | 232 UpdateDisplay("1000x600,600x400"); |
| 236 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 233 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 237 | 234 |
| 238 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); | 235 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); |
| 239 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); | 236 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); |
| 240 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow()); | 237 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow()); |
| 241 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow()); | 238 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow()); |
| 242 | 239 |
| 243 // Open system modal. Make sure it's on 2nd root window and active. | 240 // Open system modal. Make sure it's on 2nd root window and active. |
| 244 views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds( | 241 views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds( |
| 245 new ModalWidgetDelegate(), | 242 new ModalWidgetDelegate(), CurrentContext(), |
| 246 CurrentContext(), | |
| 247 gfx::Rect(1200, 100, 100, 100)); | 243 gfx::Rect(1200, 100, 100, 100)); |
| 248 modal_widget->Show(); | 244 modal_widget->Show(); |
| 249 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView())); | 245 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView())); |
| 250 EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow()); | 246 EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow()); |
| 251 EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow()); | 247 EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow()); |
| 252 | 248 |
| 253 ui::test::EventGenerator& event_generator(GetEventGenerator()); | 249 ui::test::EventGenerator& event_generator(GetEventGenerator()); |
| 254 | 250 |
| 255 // Clicking a widget on widget_on_1st display should not change activation. | 251 // Clicking a widget on widget_on_1st display should not change activation. |
| 256 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); | 252 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 if (!SupportsMultipleDisplays()) | 564 if (!SupportsMultipleDisplays()) |
| 569 return; | 565 return; |
| 570 | 566 |
| 571 UpdateDisplay("1000x600,600x400"); | 567 UpdateDisplay("1000x600,600x400"); |
| 572 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 568 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 573 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); | 569 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); |
| 574 | 570 |
| 575 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); | 571 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); |
| 576 | 572 |
| 577 d1->SetBounds(gfx::Rect(1010, 10, 100, 100)); | 573 d1->SetBounds(gfx::Rect(1010, 10, 100, 100)); |
| 578 EXPECT_EQ("1010,10 100x100", | 574 EXPECT_EQ("1010,10 100x100", d1->GetWindowBoundsInScreen().ToString()); |
| 579 d1->GetWindowBoundsInScreen().ToString()); | |
| 580 | 575 |
| 581 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); | 576 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); |
| 582 | 577 |
| 583 d1->SetBounds(gfx::Rect(10, 10, 100, 100)); | 578 d1->SetBounds(gfx::Rect(10, 10, 100, 100)); |
| 584 EXPECT_EQ("10,10 100x100", | 579 EXPECT_EQ("10,10 100x100", d1->GetWindowBoundsInScreen().ToString()); |
| 585 d1->GetWindowBoundsInScreen().ToString()); | |
| 586 | 580 |
| 587 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); | 581 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); |
| 588 | 582 |
| 589 // Make sure the bounds which doesn't fit to the root window | 583 // Make sure the bounds which doesn't fit to the root window |
| 590 // works correctly. | 584 // works correctly. |
| 591 d1->SetBounds(gfx::Rect(1560, 30, 100, 100)); | 585 d1->SetBounds(gfx::Rect(1560, 30, 100, 100)); |
| 592 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); | 586 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); |
| 593 EXPECT_EQ("1560,30 100x100", | 587 EXPECT_EQ("1560,30 100x100", d1->GetWindowBoundsInScreen().ToString()); |
| 594 d1->GetWindowBoundsInScreen().ToString()); | |
| 595 | 588 |
| 596 // Setting outside of root windows will be moved to primary root window. | 589 // Setting outside of root windows will be moved to primary root window. |
| 597 // TODO(oshima): This one probably should pick the closest root window. | 590 // TODO(oshima): This one probably should pick the closest root window. |
| 598 d1->SetBounds(gfx::Rect(200, 10, 100, 100)); | 591 d1->SetBounds(gfx::Rect(200, 10, 100, 100)); |
| 599 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); | 592 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); |
| 600 } | 593 } |
| 601 | 594 |
| 602 // Verifies if the mouse event arrives to the window even when the window | 595 // Verifies if the mouse event arrives to the window even when the window |
| 603 // moves to another root in a pre-target handler. See: crbug.com/157583 | 596 // moves to another root in a pre-target handler. See: crbug.com/157583 |
| 604 TEST_F(ExtendedDesktopTest, MoveWindowByMouseClick) { | 597 TEST_F(ExtendedDesktopTest, MoveWindowByMouseClick) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 root_windows[1]->GetBoundsInScreen()); | 630 root_windows[1]->GetBoundsInScreen()); |
| 638 EXPECT_NE(display0.id(), display1.id()); | 631 EXPECT_NE(display0.id(), display1.id()); |
| 639 | 632 |
| 640 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100)); | 633 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100)); |
| 641 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); | 634 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); |
| 642 | 635 |
| 643 // Move the window where the window spans both root windows. Since the second | 636 // Move the window where the window spans both root windows. Since the second |
| 644 // parameter is |display1|, the window should be shown on the secondary root. | 637 // parameter is |display1|, the window should be shown on the secondary root. |
| 645 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), | 638 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), |
| 646 display1); | 639 display1); |
| 647 EXPECT_EQ("500,10 1000x100", | 640 EXPECT_EQ("500,10 1000x100", d1->GetWindowBoundsInScreen().ToString()); |
| 648 d1->GetWindowBoundsInScreen().ToString()); | |
| 649 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); | 641 EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); |
| 650 | 642 |
| 651 // Move to the primary root. | 643 // Move to the primary root. |
| 652 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), | 644 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), |
| 653 display0); | 645 display0); |
| 654 EXPECT_EQ("500,10 1000x100", | 646 EXPECT_EQ("500,10 1000x100", d1->GetWindowBoundsInScreen().ToString()); |
| 655 d1->GetWindowBoundsInScreen().ToString()); | |
| 656 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); | 647 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); |
| 657 } | 648 } |
| 658 | 649 |
| 659 TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) { | 650 TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) { |
| 660 if (!SupportsMultipleDisplays()) | 651 if (!SupportsMultipleDisplays()) |
| 661 return; | 652 return; |
| 662 | 653 |
| 663 UpdateDisplay("1000x600,600x400"); | 654 UpdateDisplay("1000x600,600x400"); |
| 664 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 655 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 665 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); | 656 views::Widget* w1 = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); |
| 666 views::Widget* w1_t1 = CreateTestWidgetWithParent( | 657 views::Widget* w1_t1 = CreateTestWidgetWithParent( |
| 667 w1, gfx::Rect(50, 50, 50, 50), false /* transient */); | 658 w1, gfx::Rect(50, 50, 50, 50), false /* transient */); |
| 668 // Transient child of the transient child. | 659 // Transient child of the transient child. |
| 669 views::Widget* w1_t11 = CreateTestWidgetWithParent( | 660 views::Widget* w1_t11 = CreateTestWidgetWithParent( |
| 670 w1_t1, gfx::Rect(1200, 70, 35, 35), false /* transient */); | 661 w1_t1, gfx::Rect(1200, 70, 35, 35), false /* transient */); |
| 671 | 662 |
| 672 views::Widget* w11 = CreateTestWidgetWithParent( | 663 views::Widget* w11 = CreateTestWidgetWithParent(w1, gfx::Rect(10, 10, 40, 40), |
| 673 w1, gfx::Rect(10, 10, 40, 40), true /* child */); | 664 true /* child */); |
| 674 views::Widget* w11_t1 = CreateTestWidgetWithParent( | 665 views::Widget* w11_t1 = CreateTestWidgetWithParent( |
| 675 w1, gfx::Rect(1300, 100, 80, 80), false /* transient */); | 666 w1, gfx::Rect(1300, 100, 80, 80), false /* transient */); |
| 676 | 667 |
| 677 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); | 668 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); |
| 678 EXPECT_EQ(root_windows[0], w11->GetNativeView()->GetRootWindow()); | 669 EXPECT_EQ(root_windows[0], w11->GetNativeView()->GetRootWindow()); |
| 679 EXPECT_EQ(root_windows[0], w1_t1->GetNativeView()->GetRootWindow()); | 670 EXPECT_EQ(root_windows[0], w1_t1->GetNativeView()->GetRootWindow()); |
| 680 EXPECT_EQ(root_windows[0], w1_t11->GetNativeView()->GetRootWindow()); | 671 EXPECT_EQ(root_windows[0], w1_t11->GetNativeView()->GetRootWindow()); |
| 681 EXPECT_EQ(root_windows[0], w11_t1->GetNativeView()->GetRootWindow()); | 672 EXPECT_EQ(root_windows[0], w11_t1->GetNativeView()->GetRootWindow()); |
| 682 EXPECT_EQ("50,50 50x50", | 673 EXPECT_EQ("50,50 50x50", w1_t1->GetWindowBoundsInScreen().ToString()); |
| 683 w1_t1->GetWindowBoundsInScreen().ToString()); | 674 EXPECT_EQ("1200,70 35x35", w1_t11->GetWindowBoundsInScreen().ToString()); |
| 684 EXPECT_EQ("1200,70 35x35", | 675 EXPECT_EQ("20,20 40x40", w11->GetWindowBoundsInScreen().ToString()); |
| 685 w1_t11->GetWindowBoundsInScreen().ToString()); | 676 EXPECT_EQ("1300,100 80x80", w11_t1->GetWindowBoundsInScreen().ToString()); |
| 686 EXPECT_EQ("20,20 40x40", | |
| 687 w11->GetWindowBoundsInScreen().ToString()); | |
| 688 EXPECT_EQ("1300,100 80x80", | |
| 689 w11_t1->GetWindowBoundsInScreen().ToString()); | |
| 690 | 677 |
| 691 w1->SetBounds(gfx::Rect(1100, 10, 100, 100)); | 678 w1->SetBounds(gfx::Rect(1100, 10, 100, 100)); |
| 692 | 679 |
| 693 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); | 680 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); |
| 694 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); | 681 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); |
| 695 EXPECT_EQ(root_windows[1], w1_t11->GetNativeView()->GetRootWindow()); | 682 EXPECT_EQ(root_windows[1], w1_t11->GetNativeView()->GetRootWindow()); |
| 696 EXPECT_EQ(root_windows[1], w11->GetNativeView()->GetRootWindow()); | 683 EXPECT_EQ(root_windows[1], w11->GetNativeView()->GetRootWindow()); |
| 697 EXPECT_EQ(root_windows[1], w11_t1->GetNativeView()->GetRootWindow()); | 684 EXPECT_EQ(root_windows[1], w11_t1->GetNativeView()->GetRootWindow()); |
| 698 | 685 |
| 699 EXPECT_EQ("1110,20 40x40", | 686 EXPECT_EQ("1110,20 40x40", w11->GetWindowBoundsInScreen().ToString()); |
| 700 w11->GetWindowBoundsInScreen().ToString()); | |
| 701 // Transient window's screen bounds stays the same. | 687 // Transient window's screen bounds stays the same. |
| 702 EXPECT_EQ("50,50 50x50", | 688 EXPECT_EQ("50,50 50x50", w1_t1->GetWindowBoundsInScreen().ToString()); |
| 703 w1_t1->GetWindowBoundsInScreen().ToString()); | 689 EXPECT_EQ("1200,70 35x35", w1_t11->GetWindowBoundsInScreen().ToString()); |
| 704 EXPECT_EQ("1200,70 35x35", | 690 EXPECT_EQ("1300,100 80x80", w11_t1->GetWindowBoundsInScreen().ToString()); |
| 705 w1_t11->GetWindowBoundsInScreen().ToString()); | |
| 706 EXPECT_EQ("1300,100 80x80", | |
| 707 w11_t1->GetWindowBoundsInScreen().ToString()); | |
| 708 | 691 |
| 709 // Transient window doesn't move between root window unless | 692 // Transient window doesn't move between root window unless |
| 710 // its transient parent moves. | 693 // its transient parent moves. |
| 711 w1_t1->SetBounds(gfx::Rect(10, 50, 50, 50)); | 694 w1_t1->SetBounds(gfx::Rect(10, 50, 50, 50)); |
| 712 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); | 695 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); |
| 713 EXPECT_EQ("10,50 50x50", | 696 EXPECT_EQ("10,50 50x50", w1_t1->GetWindowBoundsInScreen().ToString()); |
| 714 w1_t1->GetWindowBoundsInScreen().ToString()); | |
| 715 } | 697 } |
| 716 | 698 |
| 717 // Test if the Window::ConvertPointToTarget works across root windows. | 699 // Test if the Window::ConvertPointToTarget works across root windows. |
| 718 // TODO(oshima): Move multiple display suport and this test to aura. | 700 // TODO(oshima): Move multiple display suport and this test to aura. |
| 719 TEST_F(ExtendedDesktopTest, ConvertPoint) { | 701 TEST_F(ExtendedDesktopTest, ConvertPoint) { |
| 720 if (!SupportsMultipleDisplays()) | 702 if (!SupportsMultipleDisplays()) |
| 721 return; | 703 return; |
| 722 display::Screen* screen = display::Screen::GetScreen(); | 704 display::Screen* screen = display::Screen::GetScreen(); |
| 723 UpdateDisplay("1000x600,600x400"); | 705 UpdateDisplay("1000x600,600x400"); |
| 724 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 706 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 // The widget should now move to the 1st root window without the property. | 809 // The widget should now move to the 1st root window without the property. |
| 828 w1->GetNativeView()->ClearProperty(kStayInSameRootWindowKey); | 810 w1->GetNativeView()->ClearProperty(kStayInSameRootWindowKey); |
| 829 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); | 811 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); |
| 830 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); | 812 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); |
| 831 | 813 |
| 832 // a window in SettingsBubbleContainer and StatusContainer should | 814 // a window in SettingsBubbleContainer and StatusContainer should |
| 833 // not move to another root window regardles of the bounds specified. | 815 // not move to another root window regardles of the bounds specified. |
| 834 aura::Window* settings_bubble_container = | 816 aura::Window* settings_bubble_container = |
| 835 Shell::GetPrimaryRootWindowController()->GetContainer( | 817 Shell::GetPrimaryRootWindowController()->GetContainer( |
| 836 kShellWindowId_SettingBubbleContainer); | 818 kShellWindowId_SettingBubbleContainer); |
| 837 aura::Window* window = aura::test::CreateTestWindowWithId( | 819 aura::Window* window = |
| 838 100, settings_bubble_container); | 820 aura::test::CreateTestWindowWithId(100, settings_bubble_container); |
| 839 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), | 821 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), |
| 840 ScreenUtil::GetSecondaryDisplay()); | 822 ScreenUtil::GetSecondaryDisplay()); |
| 841 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 823 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 842 | 824 |
| 843 aura::Window* status_container = | 825 aura::Window* status_container = |
| 844 Shell::GetPrimaryRootWindowController()->GetContainer( | 826 Shell::GetPrimaryRootWindowController()->GetContainer( |
| 845 kShellWindowId_StatusContainer); | 827 kShellWindowId_StatusContainer); |
| 846 window = aura::test::CreateTestWindowWithId(100, status_container); | 828 window = aura::test::CreateTestWindowWithId(100, status_container); |
| 847 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), | 829 window->SetBoundsInScreen(gfx::Rect(150, 10, 50, 50), |
| 848 ScreenUtil::GetSecondaryDisplay()); | 830 ScreenUtil::GetSecondaryDisplay()); |
| 849 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 831 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 850 } | 832 } |
| 851 | 833 |
| 852 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { | 834 TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { |
| 853 if (!SupportsMultipleDisplays()) | 835 if (!SupportsMultipleDisplays()) |
| 854 return; | 836 return; |
| 855 | 837 |
| 856 UpdateDisplay("100x100,200x200"); | 838 UpdateDisplay("100x100,200x200"); |
| 857 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 839 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 858 | 840 |
| 859 // Create normal windows on both displays. | 841 // Create normal windows on both displays. |
| 860 views::Widget* widget1 = CreateTestWidget( | 842 views::Widget* widget1 = CreateTestWidget( |
| 861 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); | 843 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); |
| 862 widget1->Show(); | 844 widget1->Show(); |
| 863 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow()); | 845 EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow()); |
| 864 views::Widget* widget2 = CreateTestWidget( | 846 views::Widget* widget2 = |
| 865 ScreenUtil::GetSecondaryDisplay().bounds()); | 847 CreateTestWidget(ScreenUtil::GetSecondaryDisplay().bounds()); |
| 866 widget2->Show(); | 848 widget2->Show(); |
| 867 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow()); | 849 EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow()); |
| 868 | 850 |
| 869 // Create a LockScreen window. | 851 // Create a LockScreen window. |
| 870 views::Widget* lock_widget = CreateTestWidget( | 852 views::Widget* lock_widget = CreateTestWidget( |
| 871 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); | 853 display::Screen::GetScreen()->GetPrimaryDisplay().bounds()); |
| 872 views::Textfield* textfield = new views::Textfield; | 854 views::Textfield* textfield = new views::Textfield; |
| 873 lock_widget->client_view()->AddChildView(textfield); | 855 lock_widget->client_view()->AddChildView(textfield); |
| 874 | 856 |
| 875 ash::Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 857 ash::Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 generator.ReleaseLeftButton(); | 929 generator.ReleaseLeftButton(); |
| 948 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); | 930 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); |
| 949 | 931 |
| 950 generator.MoveMouseTo(400, 150); | 932 generator.MoveMouseTo(400, 150); |
| 951 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); | 933 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); |
| 952 | 934 |
| 953 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 935 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
| 954 } | 936 } |
| 955 | 937 |
| 956 } // namespace ash | 938 } // namespace ash |
| OLD | NEW |