| 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/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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 if (!SupportsMultipleDisplays()) | 311 if (!SupportsMultipleDisplays()) |
| 312 return; | 312 return; |
| 313 | 313 |
| 314 UpdateDisplay("700x500,500x500"); | 314 UpdateDisplay("700x500,500x500"); |
| 315 SetSecondaryDisplayLayout(DisplayLayout::LEFT); | 315 SetSecondaryDisplayLayout(DisplayLayout::LEFT); |
| 316 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 316 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 317 | 317 |
| 318 EXPECT_EQ(root_windows[1], wm::GetRootWindowAt(gfx::Point(-400, 100))); | 318 EXPECT_EQ(root_windows[1], wm::GetRootWindowAt(gfx::Point(-400, 100))); |
| 319 EXPECT_EQ(root_windows[1], wm::GetRootWindowAt(gfx::Point(-1, 100))); | 319 EXPECT_EQ(root_windows[1], wm::GetRootWindowAt(gfx::Point(-1, 100))); |
| 320 EXPECT_EQ(root_windows[0], wm::GetRootWindowAt(gfx::Point(0, 300))); | 320 EXPECT_EQ(root_windows[0], wm::GetRootWindowAt(gfx::Point(0, 300))); |
| 321 EXPECT_EQ(root_windows[0], wm::GetRootWindowAt(gfx::Point(700,300))); | 321 EXPECT_EQ(root_windows[0], wm::GetRootWindowAt(gfx::Point(700, 300))); |
| 322 | 322 |
| 323 // Zero origin. | 323 // Zero origin. |
| 324 EXPECT_EQ(root_windows[0], wm::GetRootWindowAt(gfx::Point(0, 0))); | 324 EXPECT_EQ(root_windows[0], wm::GetRootWindowAt(gfx::Point(0, 0))); |
| 325 | 325 |
| 326 // Out of range point should return the nearest root window | 326 // Out of range point should return the nearest root window |
| 327 EXPECT_EQ(root_windows[1], wm::GetRootWindowAt(gfx::Point(-600, 0))); | 327 EXPECT_EQ(root_windows[1], wm::GetRootWindowAt(gfx::Point(-600, 0))); |
| 328 EXPECT_EQ(root_windows[0], wm::GetRootWindowAt(gfx::Point(701, 100))); | 328 EXPECT_EQ(root_windows[0], wm::GetRootWindowAt(gfx::Point(701, 100))); |
| 329 } | 329 } |
| 330 | 330 |
| 331 TEST_F(ExtendedDesktopTest, GetRootWindowMatching) { | 331 TEST_F(ExtendedDesktopTest, GetRootWindowMatching) { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 EXPECT_EQ(root_windows[0], w11_t1->GetNativeView()->GetRootWindow()); | 664 EXPECT_EQ(root_windows[0], w11_t1->GetNativeView()->GetRootWindow()); |
| 665 EXPECT_EQ("50,50 50x50", | 665 EXPECT_EQ("50,50 50x50", |
| 666 w1_t1->GetWindowBoundsInScreen().ToString()); | 666 w1_t1->GetWindowBoundsInScreen().ToString()); |
| 667 EXPECT_EQ("1200,70 35x35", | 667 EXPECT_EQ("1200,70 35x35", |
| 668 w1_t11->GetWindowBoundsInScreen().ToString()); | 668 w1_t11->GetWindowBoundsInScreen().ToString()); |
| 669 EXPECT_EQ("20,20 40x40", | 669 EXPECT_EQ("20,20 40x40", |
| 670 w11->GetWindowBoundsInScreen().ToString()); | 670 w11->GetWindowBoundsInScreen().ToString()); |
| 671 EXPECT_EQ("1300,100 80x80", | 671 EXPECT_EQ("1300,100 80x80", |
| 672 w11_t1->GetWindowBoundsInScreen().ToString()); | 672 w11_t1->GetWindowBoundsInScreen().ToString()); |
| 673 | 673 |
| 674 w1->SetBounds(gfx::Rect(1100,10,100,100)); | 674 w1->SetBounds(gfx::Rect(1100, 10, 100, 100)); |
| 675 | 675 |
| 676 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); | 676 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); |
| 677 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); | 677 EXPECT_EQ(root_windows[1], w1_t1->GetNativeView()->GetRootWindow()); |
| 678 EXPECT_EQ(root_windows[1], w1_t11->GetNativeView()->GetRootWindow()); | 678 EXPECT_EQ(root_windows[1], w1_t11->GetNativeView()->GetRootWindow()); |
| 679 EXPECT_EQ(root_windows[1], w11->GetNativeView()->GetRootWindow()); | 679 EXPECT_EQ(root_windows[1], w11->GetNativeView()->GetRootWindow()); |
| 680 EXPECT_EQ(root_windows[1], w11_t1->GetNativeView()->GetRootWindow()); | 680 EXPECT_EQ(root_windows[1], w11_t1->GetNativeView()->GetRootWindow()); |
| 681 | 681 |
| 682 EXPECT_EQ("1110,20 40x40", | 682 EXPECT_EQ("1110,20 40x40", |
| 683 w11->GetWindowBoundsInScreen().ToString()); | 683 w11->GetWindowBoundsInScreen().ToString()); |
| 684 // Transient window's screen bounds stays the same. | 684 // Transient window's screen bounds stays the same. |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 generator.ReleaseLeftButton(); | 929 generator.ReleaseLeftButton(); |
| 930 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); | 930 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); |
| 931 | 931 |
| 932 generator.MoveMouseTo(400, 150); | 932 generator.MoveMouseTo(400, 150); |
| 933 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); | 933 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); |
| 934 | 934 |
| 935 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); | 935 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); |
| 936 } | 936 } |
| 937 | 937 |
| 938 } // namespace ash | 938 } // namespace ash |
| OLD | NEW |