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/display/window_tree_host_manager.h" | 5 #include "ash/display/window_tree_host_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/common/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
11 #include "ash/common/wm/wm_event.h" | 12 #include "ash/common/wm/wm_event.h" |
12 #include "ash/display/display_info.h" | 13 #include "ash/display/display_info.h" |
13 #include "ash/display/display_layout_store.h" | 14 #include "ash/display/display_layout_store.h" |
14 #include "ash/display/display_manager.h" | 15 #include "ash/display/display_manager.h" |
15 #include "ash/display/display_util.h" | 16 #include "ash/display/display_util.h" |
16 #include "ash/screen_util.h" | 17 #include "ash/screen_util.h" |
17 #include "ash/shelf/shelf.h" | 18 #include "ash/shelf/shelf.h" |
18 #include "ash/shelf/shelf_widget.h" | 19 #include "ash/shelf/shelf_widget.h" |
19 #include "ash/shell.h" | 20 #include "ash/shell.h" |
| 21 #include "ash/test/ash_md_test_base.h" |
20 #include "ash/test/ash_test_base.h" | 22 #include "ash/test/ash_test_base.h" |
21 #include "ash/test/ash_test_helper.h" | 23 #include "ash/test/ash_test_helper.h" |
22 #include "ash/test/cursor_manager_test_api.h" | 24 #include "ash/test/cursor_manager_test_api.h" |
23 #include "ash/test/display_manager_test_api.h" | 25 #include "ash/test/display_manager_test_api.h" |
24 #include "ash/test/test_shell_delegate.h" | 26 #include "ash/test/test_shell_delegate.h" |
25 #include "ash/wm/window_state_aura.h" | 27 #include "ash/wm/window_state_aura.h" |
26 #include "base/command_line.h" | 28 #include "base/command_line.h" |
27 #include "ui/aura/client/focus_change_observer.h" | 29 #include "ui/aura/client/focus_change_observer.h" |
28 #include "ui/aura/client/focus_client.h" | 30 #include "ui/aura/client/focus_client.h" |
29 #include "ui/aura/env.h" | 31 #include "ui/aura/env.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 375 |
374 private: | 376 private: |
375 // views::MouseWatcherListener: | 377 // views::MouseWatcherListener: |
376 void MouseMovedOutOfHost() override {} | 378 void MouseMovedOutOfHost() override {} |
377 | 379 |
378 DISALLOW_COPY_AND_ASSIGN(TestMouseWatcherListener); | 380 DISALLOW_COPY_AND_ASSIGN(TestMouseWatcherListener); |
379 }; | 381 }; |
380 | 382 |
381 } // namespace | 383 } // namespace |
382 | 384 |
383 typedef test::AshTestBase WindowTreeHostManagerTest; | 385 using WindowTreeHostManagerTest = test::AshMDTestBase; |
| 386 |
| 387 // The prefix has intentionally been left blank since there is only one |
| 388 // parameterization of this test fixture. |
| 389 INSTANTIATE_TEST_CASE_P( |
| 390 /* prefix intentionally left blank */, |
| 391 WindowTreeHostManagerTest, |
| 392 testing::Values(MaterialDesignController::NON_MATERIAL, |
| 393 MaterialDesignController::MATERIAL_NORMAL, |
| 394 MaterialDesignController::MATERIAL_EXPERIMENTAL)); |
384 | 395 |
385 TEST_F(WindowTreeHostManagerShutdownTest, Shutdown) { | 396 TEST_F(WindowTreeHostManagerShutdownTest, Shutdown) { |
386 if (!SupportsMultipleDisplays()) | 397 if (!SupportsMultipleDisplays()) |
387 return; | 398 return; |
388 | 399 |
389 UpdateDisplay("444x333, 200x200"); | 400 UpdateDisplay("444x333, 200x200"); |
390 } | 401 } |
391 | 402 |
392 TEST_F(WindowTreeHostManagerStartupTest, Startup) { | 403 TEST_F(WindowTreeHostManagerStartupTest, Startup) { |
393 if (!SupportsMultipleDisplays()) | 404 if (!SupportsMultipleDisplays()) |
394 return; | 405 return; |
395 | 406 |
396 EXPECT_TRUE(startup_helper()->displays_initialized()); | 407 EXPECT_TRUE(startup_helper()->displays_initialized()); |
397 } | 408 } |
398 | 409 |
399 TEST_F(WindowTreeHostManagerTest, SecondaryDisplayLayout) { | 410 TEST_P(WindowTreeHostManagerTest, SecondaryDisplayLayout) { |
400 if (!SupportsMultipleDisplays()) | 411 if (!SupportsMultipleDisplays()) |
401 return; | 412 return; |
402 | 413 |
403 // Creates windows to catch activation change event. | 414 // Creates windows to catch activation change event. |
404 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); | 415 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); |
405 w1->Focus(); | 416 w1->Focus(); |
406 | 417 |
407 TestObserver observer; | 418 TestObserver observer; |
408 UpdateDisplay("500x500,400x400"); | 419 UpdateDisplay("500x500,400x400"); |
409 EXPECT_EQ(1, observer.CountAndReset()); // resize and add | 420 EXPECT_EQ(1, observer.CountAndReset()); // resize and add |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 562 } |
552 | 563 |
553 DisplayInfo CreateMirroredDisplayInfo(int64_t id, float device_scale_factor) { | 564 DisplayInfo CreateMirroredDisplayInfo(int64_t id, float device_scale_factor) { |
554 DisplayInfo info = CreateDisplayInfo(id, 0, display::Display::ROTATE_0); | 565 DisplayInfo info = CreateDisplayInfo(id, 0, display::Display::ROTATE_0); |
555 info.set_device_scale_factor(device_scale_factor); | 566 info.set_device_scale_factor(device_scale_factor); |
556 return info; | 567 return info; |
557 } | 568 } |
558 | 569 |
559 } // namespace | 570 } // namespace |
560 | 571 |
561 TEST_F(WindowTreeHostManagerTest, MirrorToDockedWithFullscreen) { | 572 TEST_P(WindowTreeHostManagerTest, MirrorToDockedWithFullscreen) { |
562 if (!SupportsMultipleDisplays()) | 573 if (!SupportsMultipleDisplays()) |
563 return; | 574 return; |
564 | 575 |
565 // Creates windows to catch activation change event. | 576 // Creates windows to catch activation change event. |
566 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); | 577 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); |
567 w1->Focus(); | 578 w1->Focus(); |
568 | 579 |
569 // Docked mode. | 580 // Docked mode. |
570 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 581 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
571 | 582 |
(...skipping 29 matching lines...) Expand all Loading... |
601 EXPECT_EQ(1, observer.GetWorkareaChangedCountAndReset()); | 612 EXPECT_EQ(1, observer.GetWorkareaChangedCountAndReset()); |
602 EXPECT_EQ(1, observer.GetPrimaryChangedCountAndReset()); | 613 EXPECT_EQ(1, observer.GetPrimaryChangedCountAndReset()); |
603 EXPECT_EQ(1, observer.CountAndReset()); | 614 EXPECT_EQ(1, observer.CountAndReset()); |
604 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); | 615 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); |
605 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); | 616 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); |
606 | 617 |
607 EXPECT_TRUE(window_state->IsFullscreen()); | 618 EXPECT_TRUE(window_state->IsFullscreen()); |
608 EXPECT_EQ("0,0 500x500", w1->bounds().ToString()); | 619 EXPECT_EQ("0,0 500x500", w1->bounds().ToString()); |
609 } | 620 } |
610 | 621 |
611 TEST_F(WindowTreeHostManagerTest, BoundsUpdated) { | 622 TEST_P(WindowTreeHostManagerTest, BoundsUpdated) { |
612 if (!SupportsMultipleDisplays()) | 623 if (!SupportsMultipleDisplays()) |
613 return; | 624 return; |
614 | 625 |
615 // Creates windows to catch activation change event. | 626 // Creates windows to catch activation change event. |
616 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); | 627 std::unique_ptr<aura::Window> w1(CreateTestWindowInShellWithId(1)); |
617 w1->Focus(); | 628 w1->Focus(); |
618 | 629 |
619 TestObserver observer; | 630 TestObserver observer; |
620 SetDefaultDisplayLayout(display::DisplayPlacement::BOTTOM); | 631 SetDefaultDisplayLayout(display::DisplayPlacement::BOTTOM); |
621 UpdateDisplay("200x200,300x300"); // layout, resize and add. | 632 UpdateDisplay("200x200,300x300"); // layout, resize and add. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 SetDisplayUIScale(primary_id, 1.125f); | 719 SetDisplayUIScale(primary_id, 1.125f); |
709 EXPECT_EQ(0, observer.CountAndReset()); | 720 EXPECT_EQ(0, observer.CountAndReset()); |
710 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); | 721 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); |
711 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); | 722 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); |
712 SetDisplayUIScale(primary_id, 1.125f); | 723 SetDisplayUIScale(primary_id, 1.125f); |
713 EXPECT_EQ(0, observer.CountAndReset()); | 724 EXPECT_EQ(0, observer.CountAndReset()); |
714 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); | 725 EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); |
715 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); | 726 EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); |
716 } | 727 } |
717 | 728 |
718 TEST_F(WindowTreeHostManagerTest, FindNearestDisplay) { | 729 TEST_P(WindowTreeHostManagerTest, FindNearestDisplay) { |
719 if (!SupportsMultipleDisplays()) | 730 if (!SupportsMultipleDisplays()) |
720 return; | 731 return; |
721 | 732 |
722 WindowTreeHostManager* window_tree_host_manager = | 733 WindowTreeHostManager* window_tree_host_manager = |
723 Shell::GetInstance()->window_tree_host_manager(); | 734 Shell::GetInstance()->window_tree_host_manager(); |
724 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 735 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
725 | 736 |
726 UpdateDisplay("200x200,300x300"); | 737 UpdateDisplay("200x200,300x300"); |
727 display_manager->SetLayoutForCurrentDisplays( | 738 display_manager->SetLayoutForCurrentDisplays( |
728 test::CreateDisplayLayout(display::DisplayPlacement::RIGHT, 50)); | 739 test::CreateDisplayLayout(display::DisplayPlacement::RIGHT, 50)); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 EXPECT_EQ(secondary_display.id(), | 781 EXPECT_EQ(secondary_display.id(), |
771 display::Screen::GetScreen() | 782 display::Screen::GetScreen() |
772 ->GetDisplayNearestPoint(gfx::Point(176, 225)) | 783 ->GetDisplayNearestPoint(gfx::Point(176, 225)) |
773 .id()); | 784 .id()); |
774 EXPECT_EQ(secondary_display.id(), | 785 EXPECT_EQ(secondary_display.id(), |
775 display::Screen::GetScreen() | 786 display::Screen::GetScreen() |
776 ->GetDisplayNearestPoint(gfx::Point(300, 400)) | 787 ->GetDisplayNearestPoint(gfx::Point(300, 400)) |
777 .id()); | 788 .id()); |
778 } | 789 } |
779 | 790 |
780 TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) { | 791 TEST_P(WindowTreeHostManagerTest, SwapPrimaryById) { |
781 if (!SupportsMultipleDisplays()) | 792 if (!SupportsMultipleDisplays()) |
782 return; | 793 return; |
| 794 const int height_offset = GetMdMaximizedWindowHeightOffset(); |
783 | 795 |
784 WindowTreeHostManager* window_tree_host_manager = | 796 WindowTreeHostManager* window_tree_host_manager = |
785 Shell::GetInstance()->window_tree_host_manager(); | 797 Shell::GetInstance()->window_tree_host_manager(); |
786 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 798 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
787 | 799 |
788 UpdateDisplay("200x200,300x300"); | 800 UpdateDisplay("200x200,300x300"); |
789 display::Display primary_display = | 801 display::Display primary_display = |
790 display::Screen::GetScreen()->GetPrimaryDisplay(); | 802 display::Screen::GetScreen()->GetPrimaryDisplay(); |
791 display::Display secondary_display = ScreenUtil::GetSecondaryDisplay(); | 803 display::Display secondary_display = ScreenUtil::GetSecondaryDisplay(); |
792 | 804 |
(...skipping 13 matching lines...) Expand all Loading... |
806 EXPECT_NE(primary_root, secondary_root); | 818 EXPECT_NE(primary_root, secondary_root); |
807 EXPECT_EQ(primary_display.id(), | 819 EXPECT_EQ(primary_display.id(), |
808 display::Screen::GetScreen() | 820 display::Screen::GetScreen() |
809 ->GetDisplayNearestPoint(gfx::Point(-100, -100)) | 821 ->GetDisplayNearestPoint(gfx::Point(-100, -100)) |
810 .id()); | 822 .id()); |
811 EXPECT_EQ( | 823 EXPECT_EQ( |
812 primary_display.id(), | 824 primary_display.id(), |
813 display::Screen::GetScreen()->GetDisplayNearestWindow(nullptr).id()); | 825 display::Screen::GetScreen()->GetDisplayNearestWindow(nullptr).id()); |
814 | 826 |
815 EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString()); | 827 EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString()); |
816 EXPECT_EQ("0,0 200x153", primary_display.work_area().ToString()); | 828 EXPECT_EQ(gfx::Rect(0, 0, 200, 153 + height_offset).ToString(), |
| 829 primary_display.work_area().ToString()); |
817 EXPECT_EQ("200,0 300x300", secondary_display.bounds().ToString()); | 830 EXPECT_EQ("200,0 300x300", secondary_display.bounds().ToString()); |
818 EXPECT_EQ("200,0 300x253", secondary_display.work_area().ToString()); | 831 EXPECT_EQ(gfx::Rect(200, 0, 300, 253 + height_offset).ToString(), |
| 832 secondary_display.work_area().ToString()); |
819 EXPECT_EQ( | 833 EXPECT_EQ( |
820 "id=2200000001, parent=2200000000, right, 50", | 834 "id=2200000001, parent=2200000000, right, 50", |
821 display_manager->GetCurrentDisplayLayout().placement_list[0].ToString()); | 835 display_manager->GetCurrentDisplayLayout().placement_list[0].ToString()); |
822 | 836 |
823 // Switch primary and secondary by display ID. | 837 // Switch primary and secondary by display ID. |
824 TestObserver observer; | 838 TestObserver observer; |
825 window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id()); | 839 window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id()); |
826 EXPECT_EQ(secondary_display.id(), | 840 EXPECT_EQ(secondary_display.id(), |
827 display::Screen::GetScreen()->GetPrimaryDisplay().id()); | 841 display::Screen::GetScreen()->GetPrimaryDisplay().id()); |
828 EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id()); | 842 EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id()); |
829 EXPECT_LT(0, observer.CountAndReset()); | 843 EXPECT_LT(0, observer.CountAndReset()); |
830 | 844 |
831 EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( | 845 EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( |
832 secondary_display.id())); | 846 secondary_display.id())); |
833 EXPECT_EQ(secondary_root, window_tree_host_manager->GetRootWindowForDisplayId( | 847 EXPECT_EQ(secondary_root, window_tree_host_manager->GetRootWindowForDisplayId( |
834 primary_display.id())); | 848 primary_display.id())); |
835 EXPECT_TRUE(primary_root->Contains(shelf_window)); | 849 EXPECT_TRUE(primary_root->Contains(shelf_window)); |
836 EXPECT_FALSE(secondary_root->Contains(shelf_window)); | 850 EXPECT_FALSE(secondary_root->Contains(shelf_window)); |
837 | 851 |
838 const display::DisplayLayout& inverted_layout = | 852 const display::DisplayLayout& inverted_layout = |
839 display_manager->GetCurrentDisplayLayout(); | 853 display_manager->GetCurrentDisplayLayout(); |
840 | 854 |
841 EXPECT_EQ("id=2200000000, parent=2200000001, left, -50", | 855 EXPECT_EQ("id=2200000000, parent=2200000001, left, -50", |
842 inverted_layout.placement_list[0].ToString()); | 856 inverted_layout.placement_list[0].ToString()); |
843 // Test if the bounds are correctly swapped. | 857 // Test if the bounds are correctly swapped. |
844 display::Display swapped_primary = | 858 display::Display swapped_primary = |
845 display::Screen::GetScreen()->GetPrimaryDisplay(); | 859 display::Screen::GetScreen()->GetPrimaryDisplay(); |
846 display::Display swapped_secondary = ScreenUtil::GetSecondaryDisplay(); | 860 display::Display swapped_secondary = ScreenUtil::GetSecondaryDisplay(); |
847 EXPECT_EQ("0,0 300x300", swapped_primary.bounds().ToString()); | 861 EXPECT_EQ("0,0 300x300", swapped_primary.bounds().ToString()); |
848 EXPECT_EQ("0,0 300x253", swapped_primary.work_area().ToString()); | 862 EXPECT_EQ(gfx::Rect(0, 0, 300, 253 + height_offset).ToString(), |
| 863 swapped_primary.work_area().ToString()); |
849 EXPECT_EQ("-200,-50 200x200", swapped_secondary.bounds().ToString()); | 864 EXPECT_EQ("-200,-50 200x200", swapped_secondary.bounds().ToString()); |
850 EXPECT_EQ("-200,-50 200x153", swapped_secondary.work_area().ToString()); | 865 EXPECT_EQ(gfx::Rect(-200, -50, 200, 153 + height_offset).ToString(), |
| 866 swapped_secondary.work_area().ToString()); |
851 | 867 |
852 // Calling the same ID don't do anything. | 868 // Calling the same ID don't do anything. |
853 window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id()); | 869 window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id()); |
854 EXPECT_EQ(0, observer.CountAndReset()); | 870 EXPECT_EQ(0, observer.CountAndReset()); |
855 | 871 |
856 aura::WindowTracker tracker; | 872 aura::WindowTracker tracker; |
857 tracker.Add(primary_root); | 873 tracker.Add(primary_root); |
858 tracker.Add(secondary_root); | 874 tracker.Add(secondary_root); |
859 | 875 |
860 // Deleting 2nd display should move the primary to original primary display. | 876 // Deleting 2nd display should move the primary to original primary display. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 EXPECT_EQ(primary_display.id(), | 928 EXPECT_EQ(primary_display.id(), |
913 display::Screen::GetScreen()->GetPrimaryDisplay().id()); | 929 display::Screen::GetScreen()->GetPrimaryDisplay().id()); |
914 EXPECT_EQ(third_display_info.id(), ScreenUtil::GetSecondaryDisplay().id()); | 930 EXPECT_EQ(third_display_info.id(), ScreenUtil::GetSecondaryDisplay().id()); |
915 EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( | 931 EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( |
916 primary_display.id())); | 932 primary_display.id())); |
917 EXPECT_NE(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( | 933 EXPECT_NE(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( |
918 third_display_info.id())); | 934 third_display_info.id())); |
919 EXPECT_TRUE(primary_root->Contains(shelf_window)); | 935 EXPECT_TRUE(primary_root->Contains(shelf_window)); |
920 } | 936 } |
921 | 937 |
922 TEST_F(WindowTreeHostManagerTest, NoSwapPrimaryWithThreeDisplays) { | 938 TEST_P(WindowTreeHostManagerTest, NoSwapPrimaryWithThreeDisplays) { |
923 if (!SupportsMultipleDisplays()) | 939 if (!SupportsMultipleDisplays()) |
924 return; | 940 return; |
925 int64_t primary = display::Screen::GetScreen()->GetPrimaryDisplay().id(); | 941 int64_t primary = display::Screen::GetScreen()->GetPrimaryDisplay().id(); |
926 UpdateDisplay("500x400,400x300,300x200"); | 942 UpdateDisplay("500x400,400x300,300x200"); |
927 EXPECT_EQ(primary, display::Screen::GetScreen()->GetPrimaryDisplay().id()); | 943 EXPECT_EQ(primary, display::Screen::GetScreen()->GetPrimaryDisplay().id()); |
928 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( | 944 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( |
929 ScreenUtil::GetSecondaryDisplay().id()); | 945 ScreenUtil::GetSecondaryDisplay().id()); |
930 EXPECT_EQ(primary, display::Screen::GetScreen()->GetPrimaryDisplay().id()); | 946 EXPECT_EQ(primary, display::Screen::GetScreen()->GetPrimaryDisplay().id()); |
931 } | 947 } |
932 | 948 |
933 TEST_F(WindowTreeHostManagerTest, OverscanInsets) { | 949 TEST_P(WindowTreeHostManagerTest, OverscanInsets) { |
934 if (!SupportsMultipleDisplays()) | 950 if (!SupportsMultipleDisplays()) |
935 return; | 951 return; |
936 | 952 |
937 WindowTreeHostManager* window_tree_host_manager = | 953 WindowTreeHostManager* window_tree_host_manager = |
938 Shell::GetInstance()->window_tree_host_manager(); | 954 Shell::GetInstance()->window_tree_host_manager(); |
939 TestEventHandler event_handler; | 955 TestEventHandler event_handler; |
940 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 956 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
941 | 957 |
942 UpdateDisplay("120x200,300x400*2"); | 958 UpdateDisplay("120x200,300x400*2"); |
943 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); | 959 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); |
(...skipping 29 matching lines...) Expand all Loading... |
973 | 989 |
974 test::SwapPrimaryDisplay(); | 990 test::SwapPrimaryDisplay(); |
975 point.SetPoint(0, 0); | 991 point.SetPoint(0, 0); |
976 Shell::GetAllRootWindows()[1]->GetHost()->GetRootTransform().TransformPoint( | 992 Shell::GetAllRootWindows()[1]->GetHost()->GetRootTransform().TransformPoint( |
977 &point); | 993 &point); |
978 EXPECT_EQ("15,10", point.ToString()); | 994 EXPECT_EQ("15,10", point.ToString()); |
979 | 995 |
980 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 996 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
981 } | 997 } |
982 | 998 |
983 TEST_F(WindowTreeHostManagerTest, Rotate) { | 999 TEST_P(WindowTreeHostManagerTest, Rotate) { |
984 if (!SupportsMultipleDisplays()) | 1000 if (!SupportsMultipleDisplays()) |
985 return; | 1001 return; |
986 | 1002 |
987 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 1003 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
988 TestEventHandler event_handler; | 1004 TestEventHandler event_handler; |
989 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 1005 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
990 | 1006 |
991 UpdateDisplay("120x200,300x400*2"); | 1007 UpdateDisplay("120x200,300x400*2"); |
992 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); | 1008 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); |
993 int64_t display2_id = ScreenUtil::GetSecondaryDisplay().id(); | 1009 int64_t display2_id = ScreenUtil::GetSecondaryDisplay().id(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 GetActiveDisplayRotation(display2_id)); | 1072 GetActiveDisplayRotation(display2_id)); |
1057 EXPECT_EQ(1, observer.GetRotationChangedCountAndReset()); | 1073 EXPECT_EQ(1, observer.GetRotationChangedCountAndReset()); |
1058 | 1074 |
1059 generator1.MoveMouseToInHost(50, 40); | 1075 generator1.MoveMouseToInHost(50, 40); |
1060 EXPECT_EQ("69,159", event_handler.GetLocationAndReset()); | 1076 EXPECT_EQ("69,159", event_handler.GetLocationAndReset()); |
1061 #endif | 1077 #endif |
1062 | 1078 |
1063 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 1079 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
1064 } | 1080 } |
1065 | 1081 |
1066 TEST_F(WindowTreeHostManagerTest, ScaleRootWindow) { | 1082 TEST_P(WindowTreeHostManagerTest, ScaleRootWindow) { |
1067 if (!SupportsMultipleDisplays()) | 1083 if (!SupportsMultipleDisplays()) |
1068 return; | 1084 return; |
1069 | 1085 |
1070 TestEventHandler event_handler; | 1086 TestEventHandler event_handler; |
1071 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 1087 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
1072 | 1088 |
1073 UpdateDisplay("600x400*2@1.5,500x300"); | 1089 UpdateDisplay("600x400*2@1.5,500x300"); |
1074 | 1090 |
1075 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); | 1091 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); |
1076 test::ScopedSetInternalDisplayId set_internal(display1.id()); | 1092 test::ScopedSetInternalDisplayId set_internal(display1.id()); |
(...skipping 15 matching lines...) Expand all Loading... |
1092 display2 = ScreenUtil::GetSecondaryDisplay(); | 1108 display2 = ScreenUtil::GetSecondaryDisplay(); |
1093 EXPECT_EQ("0,0 375x250", display1.bounds().ToString()); | 1109 EXPECT_EQ("0,0 375x250", display1.bounds().ToString()); |
1094 EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString()); | 1110 EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString()); |
1095 EXPECT_EQ("375,0 500x300", display2.bounds().ToString()); | 1111 EXPECT_EQ("375,0 500x300", display2.bounds().ToString()); |
1096 EXPECT_EQ(1.25f, GetStoredUIScale(display1.id())); | 1112 EXPECT_EQ(1.25f, GetStoredUIScale(display1.id())); |
1097 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); | 1113 EXPECT_EQ(1.0f, GetStoredUIScale(display2.id())); |
1098 | 1114 |
1099 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 1115 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
1100 } | 1116 } |
1101 | 1117 |
1102 TEST_F(WindowTreeHostManagerTest, TouchScale) { | 1118 TEST_P(WindowTreeHostManagerTest, TouchScale) { |
1103 if (!SupportsMultipleDisplays()) | 1119 if (!SupportsMultipleDisplays()) |
1104 return; | 1120 return; |
1105 | 1121 |
1106 TestEventHandler event_handler; | 1122 TestEventHandler event_handler; |
1107 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 1123 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
1108 | 1124 |
1109 UpdateDisplay("200x200*2"); | 1125 UpdateDisplay("200x200*2"); |
1110 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 1126 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); |
1111 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 1127 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
1112 aura::Window* root_window = root_windows[0]; | 1128 aura::Window* root_window = root_windows[0]; |
(...skipping 11 matching lines...) Expand all Loading... |
1124 | 1140 |
1125 // ordinal_offset is invariant to the device scale factor. | 1141 // ordinal_offset is invariant to the device scale factor. |
1126 EXPECT_EQ(event_handler.scroll_x_offset(), | 1142 EXPECT_EQ(event_handler.scroll_x_offset(), |
1127 event_handler.scroll_x_offset_ordinal()); | 1143 event_handler.scroll_x_offset_ordinal()); |
1128 EXPECT_EQ(event_handler.scroll_y_offset(), | 1144 EXPECT_EQ(event_handler.scroll_y_offset(), |
1129 event_handler.scroll_y_offset_ordinal()); | 1145 event_handler.scroll_y_offset_ordinal()); |
1130 | 1146 |
1131 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 1147 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
1132 } | 1148 } |
1133 | 1149 |
1134 TEST_F(WindowTreeHostManagerTest, ConvertHostToRootCoords) { | 1150 TEST_P(WindowTreeHostManagerTest, ConvertHostToRootCoords) { |
1135 if (!SupportsMultipleDisplays()) | 1151 if (!SupportsMultipleDisplays()) |
1136 return; | 1152 return; |
1137 | 1153 |
1138 TestEventHandler event_handler; | 1154 TestEventHandler event_handler; |
1139 Shell::GetInstance()->AddPreTargetHandler(&event_handler); | 1155 Shell::GetInstance()->AddPreTargetHandler(&event_handler); |
1140 | 1156 |
1141 UpdateDisplay("600x400*2/r@1.5"); | 1157 UpdateDisplay("600x400*2/r@1.5"); |
1142 | 1158 |
1143 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); | 1159 display::Display display1 = display::Screen::GetScreen()->GetPrimaryDisplay(); |
1144 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 1160 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 generator.MoveMouseToInHost(599, 399); | 1202 generator.MoveMouseToInHost(599, 399); |
1187 EXPECT_EQ("0,449", event_handler.GetLocationAndReset()); | 1203 EXPECT_EQ("0,449", event_handler.GetLocationAndReset()); |
1188 generator.MoveMouseToInHost(0, 399); | 1204 generator.MoveMouseToInHost(0, 399); |
1189 EXPECT_EQ("0,0", event_handler.GetLocationAndReset()); | 1205 EXPECT_EQ("0,0", event_handler.GetLocationAndReset()); |
1190 | 1206 |
1191 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 1207 Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
1192 } | 1208 } |
1193 | 1209 |
1194 // Make sure that the compositor based mirroring can switch | 1210 // Make sure that the compositor based mirroring can switch |
1195 // from/to dock mode. | 1211 // from/to dock mode. |
1196 TEST_F(WindowTreeHostManagerTest, DockToSingle) { | 1212 TEST_P(WindowTreeHostManagerTest, DockToSingle) { |
1197 if (!SupportsMultipleDisplays()) | 1213 if (!SupportsMultipleDisplays()) |
1198 return; | 1214 return; |
1199 | 1215 |
1200 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 1216 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
1201 | 1217 |
1202 const int64_t internal_id = 1; | 1218 const int64_t internal_id = 1; |
1203 | 1219 |
1204 const DisplayInfo internal_display_info = | 1220 const DisplayInfo internal_display_info = |
1205 CreateDisplayInfo(internal_id, 0, display::Display::ROTATE_0); | 1221 CreateDisplayInfo(internal_id, 0, display::Display::ROTATE_0); |
1206 const DisplayInfo external_display_info = | 1222 const DisplayInfo external_display_info = |
(...skipping 25 matching lines...) Expand all Loading... |
1232 display_info_list.push_back(internal_display_info); | 1248 display_info_list.push_back(internal_display_info); |
1233 display_manager->OnNativeDisplaysChanged(display_info_list); | 1249 display_manager->OnNativeDisplaysChanged(display_info_list); |
1234 EXPECT_TRUE(Shell::GetPrimaryRootWindow() | 1250 EXPECT_TRUE(Shell::GetPrimaryRootWindow() |
1235 ->GetHost() | 1251 ->GetHost() |
1236 ->GetRootTransform() | 1252 ->GetRootTransform() |
1237 .IsIdentityOrIntegerTranslation()); | 1253 .IsIdentityOrIntegerTranslation()); |
1238 } | 1254 } |
1239 | 1255 |
1240 // Tests if switching two displays at the same time while the primary display | 1256 // Tests if switching two displays at the same time while the primary display |
1241 // is swapped should not cause a crash. (crbug.com/426292) | 1257 // is swapped should not cause a crash. (crbug.com/426292) |
1242 TEST_F(WindowTreeHostManagerTest, ReplaceSwappedPrimary) { | 1258 TEST_P(WindowTreeHostManagerTest, ReplaceSwappedPrimary) { |
1243 if (!SupportsMultipleDisplays()) | 1259 if (!SupportsMultipleDisplays()) |
1244 return; | 1260 return; |
1245 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 1261 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
1246 | 1262 |
1247 const DisplayInfo first_display_info = | 1263 const DisplayInfo first_display_info = |
1248 CreateDisplayInfo(10, 0, display::Display::ROTATE_0); | 1264 CreateDisplayInfo(10, 0, display::Display::ROTATE_0); |
1249 const DisplayInfo second_display_info = | 1265 const DisplayInfo second_display_info = |
1250 CreateDisplayInfo(11, 1, display::Display::ROTATE_0); | 1266 CreateDisplayInfo(11, 1, display::Display::ROTATE_0); |
1251 | 1267 |
1252 std::vector<DisplayInfo> display_info_list; | 1268 std::vector<DisplayInfo> display_info_list; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 }; | 1311 }; |
1296 | 1312 |
1297 } // names | 1313 } // names |
1298 | 1314 |
1299 // Make sure that GetShelfDisplayBoundsInRoot returns the correct bounds | 1315 // Make sure that GetShelfDisplayBoundsInRoot returns the correct bounds |
1300 // when primary display gets replaced in a following scenario. | 1316 // when primary display gets replaced in a following scenario. |
1301 // 1) Two displays connected: a) b) | 1317 // 1) Two displays connected: a) b) |
1302 // 2) both are disconnected and new one with the same size as b) is connected | 1318 // 2) both are disconnected and new one with the same size as b) is connected |
1303 // in one configuration event. | 1319 // in one configuration event. |
1304 // See crbug.com/547280. | 1320 // See crbug.com/547280. |
1305 TEST_F(WindowTreeHostManagerTest, ReplacePrimary) { | 1321 TEST_P(WindowTreeHostManagerTest, ReplacePrimary) { |
1306 if (!SupportsMultipleDisplays()) | 1322 if (!SupportsMultipleDisplays()) |
1307 return; | 1323 return; |
1308 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 1324 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
1309 | 1325 |
1310 DisplayInfo first_display_info = | 1326 DisplayInfo first_display_info = |
1311 CreateDisplayInfo(10, 0, display::Display::ROTATE_0); | 1327 CreateDisplayInfo(10, 0, display::Display::ROTATE_0); |
1312 first_display_info.SetBounds(gfx::Rect(0, 0, 400, 400)); | 1328 first_display_info.SetBounds(gfx::Rect(0, 0, 400, 400)); |
1313 const DisplayInfo second_display_info = | 1329 const DisplayInfo second_display_info = |
1314 CreateDisplayInfo(11, 500, display::Display::ROTATE_0); | 1330 CreateDisplayInfo(11, 500, display::Display::ROTATE_0); |
1315 | 1331 |
(...skipping 11 matching lines...) Expand all Loading... |
1327 display_info_list.clear(); | 1343 display_info_list.clear(); |
1328 const DisplayInfo new_first_display_info = | 1344 const DisplayInfo new_first_display_info = |
1329 CreateDisplayInfo(new_display_id, 0, display::Display::ROTATE_0); | 1345 CreateDisplayInfo(new_display_id, 0, display::Display::ROTATE_0); |
1330 | 1346 |
1331 display_info_list.push_back(new_first_display_info); | 1347 display_info_list.push_back(new_first_display_info); |
1332 display_manager->OnNativeDisplaysChanged(display_info_list); | 1348 display_manager->OnNativeDisplaysChanged(display_info_list); |
1333 EXPECT_EQ("0,0 500x500", test_observer.shelf_display_bounds().ToString()); | 1349 EXPECT_EQ("0,0 500x500", test_observer.shelf_display_bounds().ToString()); |
1334 primary_root->RemoveObserver(&test_observer); | 1350 primary_root->RemoveObserver(&test_observer); |
1335 } | 1351 } |
1336 | 1352 |
1337 TEST_F(WindowTreeHostManagerTest, UpdateMouseLocationAfterDisplayChange) { | 1353 TEST_P(WindowTreeHostManagerTest, UpdateMouseLocationAfterDisplayChange) { |
1338 if (!SupportsMultipleDisplays()) | 1354 if (!SupportsMultipleDisplays()) |
1339 return; | 1355 return; |
1340 | 1356 |
1341 UpdateDisplay("200x200,300x300"); | 1357 UpdateDisplay("200x200,300x300"); |
1342 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 1358 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
1343 | 1359 |
1344 aura::Env* env = aura::Env::GetInstance(); | 1360 aura::Env* env = aura::Env::GetInstance(); |
1345 | 1361 |
1346 ui::test::EventGenerator generator(root_windows[0]); | 1362 ui::test::EventGenerator generator(root_windows[0]); |
1347 | 1363 |
(...skipping 22 matching lines...) Expand all Loading... |
1370 | 1386 |
1371 // Move the mouse pointer to the bottom of 1st display. | 1387 // Move the mouse pointer to the bottom of 1st display. |
1372 generator.MoveMouseToInHost(150, 290); | 1388 generator.MoveMouseToInHost(150, 290); |
1373 EXPECT_EQ("150,290", env->last_mouse_location().ToString()); | 1389 EXPECT_EQ("150,290", env->last_mouse_location().ToString()); |
1374 | 1390 |
1375 // The mouse pointer is now on 2nd display. | 1391 // The mouse pointer is now on 2nd display. |
1376 UpdateDisplay("300x280,200x200"); | 1392 UpdateDisplay("300x280,200x200"); |
1377 EXPECT_EQ("450,10", env->last_mouse_location().ToString()); | 1393 EXPECT_EQ("450,10", env->last_mouse_location().ToString()); |
1378 } | 1394 } |
1379 | 1395 |
1380 TEST_F(WindowTreeHostManagerTest, | 1396 TEST_P(WindowTreeHostManagerTest, |
1381 UpdateMouseLocationAfterDisplayChange_2ndOnLeft) { | 1397 UpdateMouseLocationAfterDisplayChange_2ndOnLeft) { |
1382 if (!SupportsMultipleDisplays()) | 1398 if (!SupportsMultipleDisplays()) |
1383 return; | 1399 return; |
1384 | 1400 |
1385 // Set the 2nd display on the left. | 1401 // Set the 2nd display on the left. |
1386 DisplayLayoutStore* layout_store = | 1402 DisplayLayoutStore* layout_store = |
1387 Shell::GetInstance()->display_manager()->layout_store(); | 1403 Shell::GetInstance()->display_manager()->layout_store(); |
1388 display::DisplayPlacement new_default(display::DisplayPlacement::LEFT, 0); | 1404 display::DisplayPlacement new_default(display::DisplayPlacement::LEFT, 0); |
1389 layout_store->SetDefaultDisplayPlacement(new_default); | 1405 layout_store->SetDefaultDisplayPlacement(new_default); |
1390 | 1406 |
(...skipping 19 matching lines...) Expand all Loading... |
1410 EXPECT_EQ("-100,50", env->last_mouse_location().ToString()); | 1426 EXPECT_EQ("-100,50", env->last_mouse_location().ToString()); |
1411 | 1427 |
1412 // 2nd display was disconnected. Mouse pointer should move to | 1428 // 2nd display was disconnected. Mouse pointer should move to |
1413 // 1st display. | 1429 // 1st display. |
1414 UpdateDisplay("300x300"); | 1430 UpdateDisplay("300x300"); |
1415 EXPECT_EQ("150,150", env->last_mouse_location().ToString()); | 1431 EXPECT_EQ("150,150", env->last_mouse_location().ToString()); |
1416 } | 1432 } |
1417 | 1433 |
1418 // Test that the cursor swaps displays and that its scale factor and rotation | 1434 // Test that the cursor swaps displays and that its scale factor and rotation |
1419 // are updated when the primary display is swapped. | 1435 // are updated when the primary display is swapped. |
1420 TEST_F(WindowTreeHostManagerTest, | 1436 TEST_P(WindowTreeHostManagerTest, |
1421 UpdateMouseLocationAfterDisplayChange_SwapPrimary) { | 1437 UpdateMouseLocationAfterDisplayChange_SwapPrimary) { |
1422 if (!SupportsMultipleDisplays()) | 1438 if (!SupportsMultipleDisplays()) |
1423 return; | 1439 return; |
1424 | 1440 |
1425 UpdateDisplay("200x200,200x200*2/r"); | 1441 UpdateDisplay("200x200,200x200*2/r"); |
1426 | 1442 |
1427 aura::Env* env = aura::Env::GetInstance(); | 1443 aura::Env* env = aura::Env::GetInstance(); |
1428 Shell* shell = Shell::GetInstance(); | 1444 Shell* shell = Shell::GetInstance(); |
1429 WindowTreeHostManager* window_tree_host_manager = | 1445 WindowTreeHostManager* window_tree_host_manager = |
1430 shell->window_tree_host_manager(); | 1446 shell->window_tree_host_manager(); |
1431 test::CursorManagerTestApi test_api(shell->cursor_manager()); | 1447 test::CursorManagerTestApi test_api(shell->cursor_manager()); |
1432 | 1448 |
1433 window_tree_host_manager->GetPrimaryRootWindow()->MoveCursorTo( | 1449 window_tree_host_manager->GetPrimaryRootWindow()->MoveCursorTo( |
1434 gfx::Point(20, 50)); | 1450 gfx::Point(20, 50)); |
1435 | 1451 |
1436 EXPECT_EQ("20,50", env->last_mouse_location().ToString()); | 1452 EXPECT_EQ("20,50", env->last_mouse_location().ToString()); |
1437 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); | 1453 EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); |
1438 EXPECT_EQ(display::Display::ROTATE_0, test_api.GetCurrentCursorRotation()); | 1454 EXPECT_EQ(display::Display::ROTATE_0, test_api.GetCurrentCursorRotation()); |
1439 | 1455 |
1440 test::SwapPrimaryDisplay(); | 1456 test::SwapPrimaryDisplay(); |
1441 | 1457 |
1442 EXPECT_EQ("20,50", env->last_mouse_location().ToString()); | 1458 EXPECT_EQ("20,50", env->last_mouse_location().ToString()); |
1443 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); | 1459 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); |
1444 EXPECT_EQ(display::Display::ROTATE_90, test_api.GetCurrentCursorRotation()); | 1460 EXPECT_EQ(display::Display::ROTATE_90, test_api.GetCurrentCursorRotation()); |
1445 } | 1461 } |
1446 | 1462 |
1447 // Test that the cursor moves to the other display and that its scale factor | 1463 // Test that the cursor moves to the other display and that its scale factor |
1448 // and rotation are updated when the primary display is disconnected. | 1464 // and rotation are updated when the primary display is disconnected. |
1449 TEST_F(WindowTreeHostManagerTest, | 1465 TEST_P(WindowTreeHostManagerTest, |
1450 UpdateMouseLocationAfterDisplayChange_PrimaryDisconnected) { | 1466 UpdateMouseLocationAfterDisplayChange_PrimaryDisconnected) { |
1451 if (!SupportsMultipleDisplays()) | 1467 if (!SupportsMultipleDisplays()) |
1452 return; | 1468 return; |
1453 | 1469 |
1454 aura::Env* env = aura::Env::GetInstance(); | 1470 aura::Env* env = aura::Env::GetInstance(); |
1455 Shell* shell = Shell::GetInstance(); | 1471 Shell* shell = Shell::GetInstance(); |
1456 WindowTreeHostManager* window_tree_host_manager = | 1472 WindowTreeHostManager* window_tree_host_manager = |
1457 shell->window_tree_host_manager(); | 1473 shell->window_tree_host_manager(); |
1458 test::CursorManagerTestApi test_api(shell->cursor_manager()); | 1474 test::CursorManagerTestApi test_api(shell->cursor_manager()); |
1459 | 1475 |
(...skipping 15 matching lines...) Expand all Loading... |
1475 window_tree_host_manager->GetPrimaryDisplayId()); | 1491 window_tree_host_manager->GetPrimaryDisplayId()); |
1476 | 1492 |
1477 // Cursor should be centered on the remaining display. | 1493 // Cursor should be centered on the remaining display. |
1478 EXPECT_EQ("75,75", env->last_mouse_location().ToString()); | 1494 EXPECT_EQ("75,75", env->last_mouse_location().ToString()); |
1479 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); | 1495 EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); |
1480 EXPECT_EQ(display::Display::ROTATE_90, test_api.GetCurrentCursorRotation()); | 1496 EXPECT_EQ(display::Display::ROTATE_90, test_api.GetCurrentCursorRotation()); |
1481 } | 1497 } |
1482 | 1498 |
1483 // GetRootWindowForDisplayId() for removed display::Display during | 1499 // GetRootWindowForDisplayId() for removed display::Display during |
1484 // OnDisplayRemoved() should not cause crash. See http://crbug.com/415222 | 1500 // OnDisplayRemoved() should not cause crash. See http://crbug.com/415222 |
1485 TEST_F(WindowTreeHostManagerTest, | 1501 TEST_P(WindowTreeHostManagerTest, |
1486 GetRootWindowForDisplayIdDuringDisplayDisconnection) { | 1502 GetRootWindowForDisplayIdDuringDisplayDisconnection) { |
1487 if (!SupportsMultipleDisplays()) | 1503 if (!SupportsMultipleDisplays()) |
1488 return; | 1504 return; |
1489 | 1505 |
1490 UpdateDisplay("300x300,200x200"); | 1506 UpdateDisplay("300x300,200x200"); |
1491 aura::Window* root2 = | 1507 aura::Window* root2 = |
1492 Shell::GetInstance() | 1508 Shell::GetInstance() |
1493 ->window_tree_host_manager() | 1509 ->window_tree_host_manager() |
1494 ->GetRootWindowForDisplayId(ScreenUtil::GetSecondaryDisplay().id()); | 1510 ->GetRootWindowForDisplayId(ScreenUtil::GetSecondaryDisplay().id()); |
1495 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( | 1511 views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( |
(...skipping 12 matching lines...) Expand all Loading... |
1508 widget->GetNativeWindow()->GetRootWindow()); | 1524 widget->GetNativeWindow()->GetRootWindow()); |
1509 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); | 1525 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); |
1510 | 1526 |
1511 UpdateDisplay("300x300"); | 1527 UpdateDisplay("300x300"); |
1512 watcher.Stop(); | 1528 watcher.Stop(); |
1513 | 1529 |
1514 widget->CloseNow(); | 1530 widget->CloseNow(); |
1515 } | 1531 } |
1516 | 1532 |
1517 } // namespace ash | 1533 } // namespace ash |
OLD | NEW |