| 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 "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_info.h" | 8 #include "ash/display/display_info.h" |
| 9 #include "ash/display/display_layout_store.h" | 9 #include "ash/display/display_layout_store.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 .id()); | 800 .id()); |
| 801 EXPECT_EQ(primary_display.id(), | 801 EXPECT_EQ(primary_display.id(), |
| 802 gfx::Screen::GetScreen()->GetDisplayNearestWindow(nullptr).id()); | 802 gfx::Screen::GetScreen()->GetDisplayNearestWindow(nullptr).id()); |
| 803 | 803 |
| 804 EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString()); | 804 EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString()); |
| 805 EXPECT_EQ("0,0 200x153", primary_display.work_area().ToString()); | 805 EXPECT_EQ("0,0 200x153", primary_display.work_area().ToString()); |
| 806 EXPECT_EQ("200,0 300x300", secondary_display.bounds().ToString()); | 806 EXPECT_EQ("200,0 300x300", secondary_display.bounds().ToString()); |
| 807 EXPECT_EQ("200,0 300x253", secondary_display.work_area().ToString()); | 807 EXPECT_EQ("200,0 300x253", secondary_display.work_area().ToString()); |
| 808 EXPECT_EQ( | 808 EXPECT_EQ( |
| 809 "id=2200000001, parent=2200000000, right, 50", | 809 "id=2200000001, parent=2200000000, right, 50", |
| 810 display_manager->GetCurrentDisplayLayout().placement_list[0]->ToString()); | 810 display_manager->GetCurrentDisplayLayout().placement_list[0].ToString()); |
| 811 | 811 |
| 812 // Switch primary and secondary by display ID. | 812 // Switch primary and secondary by display ID. |
| 813 TestObserver observer; | 813 TestObserver observer; |
| 814 window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id()); | 814 window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id()); |
| 815 EXPECT_EQ(secondary_display.id(), | 815 EXPECT_EQ(secondary_display.id(), |
| 816 gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); | 816 gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); |
| 817 EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id()); | 817 EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id()); |
| 818 EXPECT_LT(0, observer.CountAndReset()); | 818 EXPECT_LT(0, observer.CountAndReset()); |
| 819 | 819 |
| 820 EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( | 820 EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( |
| 821 secondary_display.id())); | 821 secondary_display.id())); |
| 822 EXPECT_EQ(secondary_root, window_tree_host_manager->GetRootWindowForDisplayId( | 822 EXPECT_EQ(secondary_root, window_tree_host_manager->GetRootWindowForDisplayId( |
| 823 primary_display.id())); | 823 primary_display.id())); |
| 824 EXPECT_TRUE(primary_root->Contains(shelf_window)); | 824 EXPECT_TRUE(primary_root->Contains(shelf_window)); |
| 825 EXPECT_FALSE(secondary_root->Contains(shelf_window)); | 825 EXPECT_FALSE(secondary_root->Contains(shelf_window)); |
| 826 | 826 |
| 827 const DisplayLayout& inverted_layout = | 827 const DisplayLayout& inverted_layout = |
| 828 display_manager->GetCurrentDisplayLayout(); | 828 display_manager->GetCurrentDisplayLayout(); |
| 829 | 829 |
| 830 EXPECT_EQ("id=2200000000, parent=2200000001, left, -50", | 830 EXPECT_EQ("id=2200000000, parent=2200000001, left, -50", |
| 831 inverted_layout.placement_list[0]->ToString()); | 831 inverted_layout.placement_list[0].ToString()); |
| 832 // Test if the bounds are correctly swapped. | 832 // Test if the bounds are correctly swapped. |
| 833 gfx::Display swapped_primary = gfx::Screen::GetScreen()->GetPrimaryDisplay(); | 833 gfx::Display swapped_primary = gfx::Screen::GetScreen()->GetPrimaryDisplay(); |
| 834 gfx::Display swapped_secondary = ScreenUtil::GetSecondaryDisplay(); | 834 gfx::Display swapped_secondary = ScreenUtil::GetSecondaryDisplay(); |
| 835 EXPECT_EQ("0,0 300x300", swapped_primary.bounds().ToString()); | 835 EXPECT_EQ("0,0 300x300", swapped_primary.bounds().ToString()); |
| 836 EXPECT_EQ("0,0 300x253", swapped_primary.work_area().ToString()); | 836 EXPECT_EQ("0,0 300x253", swapped_primary.work_area().ToString()); |
| 837 EXPECT_EQ("-200,-50 200x200", swapped_secondary.bounds().ToString()); | 837 EXPECT_EQ("-200,-50 200x200", swapped_secondary.bounds().ToString()); |
| 838 EXPECT_EQ("-200,-50 200x153", swapped_secondary.work_area().ToString()); | 838 EXPECT_EQ("-200,-50 200x153", swapped_secondary.work_area().ToString()); |
| 839 | 839 |
| 840 // Calling the same ID don't do anything. | 840 // Calling the same ID don't do anything. |
| 841 window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id()); | 841 window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id()); |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 widget->GetNativeWindow()->GetRootWindow()); | 1487 widget->GetNativeWindow()->GetRootWindow()); |
| 1488 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); | 1488 event_generator.MoveMouseToCenterOf(widget->GetNativeWindow()); |
| 1489 | 1489 |
| 1490 UpdateDisplay("300x300"); | 1490 UpdateDisplay("300x300"); |
| 1491 watcher.Stop(); | 1491 watcher.Stop(); |
| 1492 | 1492 |
| 1493 widget->CloseNow(); | 1493 widget->CloseNow(); |
| 1494 } | 1494 } |
| 1495 | 1495 |
| 1496 } // namespace ash | 1496 } // namespace ash |
| OLD | NEW |