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/multi_display_manager.h" | 6 #include "ash/display/multi_display_manager.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/coordinate_conversion.h" | 10 #include "ash/wm/coordinate_conversion.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 EXPECT_EQ(ui::kCursorCopy, root_windows[1]->last_cursor().native_type()); | 183 EXPECT_EQ(ui::kCursorCopy, root_windows[1]->last_cursor().native_type()); |
184 } | 184 } |
185 | 185 |
186 TEST_F(ExtendedDesktopTest, TestCursorLocation) { | 186 TEST_F(ExtendedDesktopTest, TestCursorLocation) { |
187 UpdateDisplay("0+0-1000x600,1001+0-600x400"); | 187 UpdateDisplay("0+0-1000x600,1001+0-600x400"); |
188 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 188 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
189 aura::Window::TestApi root_window0_test_api(root_windows[0]); | 189 aura::Window::TestApi root_window0_test_api(root_windows[0]); |
190 aura::Window::TestApi root_window1_test_api(root_windows[1]); | 190 aura::Window::TestApi root_window1_test_api(root_windows[1]); |
191 | 191 |
192 root_windows[0]->MoveCursorTo(gfx::Point(10, 10)); | 192 root_windows[0]->MoveCursorTo(gfx::Point(10, 10)); |
193 EXPECT_EQ("10,10", gfx::Screen::GetCursorScreenPoint().ToString()); | 193 EXPECT_EQ("10,10", |
| 194 Shell::GetAshScreen()->GetCursorScreenPoint().ToString()); |
194 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); | 195 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); |
195 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); | 196 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); |
196 root_windows[1]->MoveCursorTo(gfx::Point(10, 20)); | 197 root_windows[1]->MoveCursorTo(gfx::Point(10, 20)); |
197 EXPECT_EQ("1010,20", gfx::Screen::GetCursorScreenPoint().ToString()); | 198 EXPECT_EQ("1010,20", |
| 199 Shell::GetAshScreen()->GetCursorScreenPoint().ToString()); |
198 EXPECT_FALSE(root_window0_test_api.ContainsMouse()); | 200 EXPECT_FALSE(root_window0_test_api.ContainsMouse()); |
199 EXPECT_TRUE(root_window1_test_api.ContainsMouse()); | 201 EXPECT_TRUE(root_window1_test_api.ContainsMouse()); |
200 root_windows[0]->MoveCursorTo(gfx::Point(20, 10)); | 202 root_windows[0]->MoveCursorTo(gfx::Point(20, 10)); |
201 EXPECT_EQ("20,10", gfx::Screen::GetCursorScreenPoint().ToString()); | 203 EXPECT_EQ("20,10", |
| 204 Shell::GetAshScreen()->GetCursorScreenPoint().ToString()); |
202 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); | 205 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); |
203 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); | 206 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); |
204 } | 207 } |
205 | 208 |
206 TEST_F(ExtendedDesktopTest, CycleWindows) { | 209 TEST_F(ExtendedDesktopTest, CycleWindows) { |
207 UpdateDisplay("700x500,500x500"); | 210 UpdateDisplay("700x500,500x500"); |
208 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 211 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
209 | 212 |
210 WindowCycleController* controller = | 213 WindowCycleController* controller = |
211 Shell::GetInstance()->window_cycle_controller(); | 214 Shell::GetInstance()->window_cycle_controller(); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // Setting outside of root windows will be moved to primary root window. | 404 // Setting outside of root windows will be moved to primary root window. |
402 // TODO(oshima): This one probably should pick the closest root window. | 405 // TODO(oshima): This one probably should pick the closest root window. |
403 d1->SetBounds(gfx::Rect(200, 10, 100, 100)); | 406 d1->SetBounds(gfx::Rect(200, 10, 100, 100)); |
404 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); | 407 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); |
405 } | 408 } |
406 | 409 |
407 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { | 410 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { |
408 UpdateDisplay("1000x1000,1000x1000"); | 411 UpdateDisplay("1000x1000,1000x1000"); |
409 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 412 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
410 | 413 |
411 gfx::Display display0 = | 414 gfx::Display display0 = Shell::GetAshScreen()->GetDisplayMatching( |
412 gfx::Screen::GetDisplayMatching(root_windows[0]->GetBoundsInScreen()); | 415 root_windows[0]->GetBoundsInScreen()); |
413 gfx::Display display1 = | 416 gfx::Display display1 = Shell::GetAshScreen()->GetDisplayMatching( |
414 gfx::Screen::GetDisplayMatching(root_windows[1]->GetBoundsInScreen()); | 417 root_windows[1]->GetBoundsInScreen()); |
415 EXPECT_NE(display0.id(), display1.id()); | 418 EXPECT_NE(display0.id(), display1.id()); |
416 | 419 |
417 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100)); | 420 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100)); |
418 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); | 421 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); |
419 | 422 |
420 // Move the window where the window spans both root windows. Since the second | 423 // Move the window where the window spans both root windows. Since the second |
421 // parameter is |display1|, the window should be shown on the secondary root. | 424 // parameter is |display1|, the window should be shown on the secondary root. |
422 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), | 425 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), |
423 display1); | 426 display1); |
424 EXPECT_EQ("500,10 1000x100", | 427 EXPECT_EQ("500,10 1000x100", |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); | 597 EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow()); |
595 | 598 |
596 // The widget should now move to the 1st root window without the property. | 599 // The widget should now move to the 1st root window without the property. |
597 w1->GetNativeView()->ClearProperty(internal::kStayInSameRootWindowKey); | 600 w1->GetNativeView()->ClearProperty(internal::kStayInSameRootWindowKey); |
598 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); | 601 w1->SetBounds(gfx::Rect(10, 10, 50, 50)); |
599 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); | 602 EXPECT_EQ(root_windows[0], w1->GetNativeView()->GetRootWindow()); |
600 } | 603 } |
601 | 604 |
602 } // namespace internal | 605 } // namespace internal |
603 } // namespace ash | 606 } // namespace ash |
OLD | NEW |