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/screen_ash.h" | 7 #include "ash/screen_ash.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 EXPECT_EQ(ui::kCursorCopy, root_windows[1]->last_cursor().native_type()); | 187 EXPECT_EQ(ui::kCursorCopy, root_windows[1]->last_cursor().native_type()); |
188 } | 188 } |
189 | 189 |
190 TEST_F(ExtendedDesktopTest, TestCursorLocation) { | 190 TEST_F(ExtendedDesktopTest, TestCursorLocation) { |
191 UpdateDisplay("0+0-1000x600,1001+0-600x400"); | 191 UpdateDisplay("0+0-1000x600,1001+0-600x400"); |
192 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 192 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
193 aura::Window::TestApi root_window0_test_api(root_windows[0]); | 193 aura::Window::TestApi root_window0_test_api(root_windows[0]); |
194 aura::Window::TestApi root_window1_test_api(root_windows[1]); | 194 aura::Window::TestApi root_window1_test_api(root_windows[1]); |
195 | 195 |
196 root_windows[0]->MoveCursorTo(gfx::Point(10, 10)); | 196 root_windows[0]->MoveCursorTo(gfx::Point(10, 10)); |
197 EXPECT_EQ("10,10", gfx::Screen::GetCursorScreenPoint().ToString()); | 197 EXPECT_EQ("10,10", |
| 198 Shell::GetAshScreen()->GetCursorScreenPoint().ToString()); |
198 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); | 199 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); |
199 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); | 200 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); |
200 root_windows[1]->MoveCursorTo(gfx::Point(10, 20)); | 201 root_windows[1]->MoveCursorTo(gfx::Point(10, 20)); |
201 EXPECT_EQ("1010,20", gfx::Screen::GetCursorScreenPoint().ToString()); | 202 EXPECT_EQ("1010,20", |
| 203 Shell::GetAshScreen()->GetCursorScreenPoint().ToString()); |
202 EXPECT_FALSE(root_window0_test_api.ContainsMouse()); | 204 EXPECT_FALSE(root_window0_test_api.ContainsMouse()); |
203 EXPECT_TRUE(root_window1_test_api.ContainsMouse()); | 205 EXPECT_TRUE(root_window1_test_api.ContainsMouse()); |
204 root_windows[0]->MoveCursorTo(gfx::Point(20, 10)); | 206 root_windows[0]->MoveCursorTo(gfx::Point(20, 10)); |
205 EXPECT_EQ("20,10", gfx::Screen::GetCursorScreenPoint().ToString()); | 207 EXPECT_EQ("20,10", |
| 208 Shell::GetAshScreen()->GetCursorScreenPoint().ToString()); |
206 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); | 209 EXPECT_TRUE(root_window0_test_api.ContainsMouse()); |
207 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); | 210 EXPECT_FALSE(root_window1_test_api.ContainsMouse()); |
208 } | 211 } |
209 | 212 |
210 TEST_F(ExtendedDesktopTest, CycleWindows) { | 213 TEST_F(ExtendedDesktopTest, CycleWindows) { |
211 UpdateDisplay("700x500,500x500"); | 214 UpdateDisplay("700x500,500x500"); |
212 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 215 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
213 | 216 |
214 WindowCycleController* controller = | 217 WindowCycleController* controller = |
215 Shell::GetInstance()->window_cycle_controller(); | 218 Shell::GetInstance()->window_cycle_controller(); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 // Setting outside of root windows will be moved to primary root window. | 408 // Setting outside of root windows will be moved to primary root window. |
406 // TODO(oshima): This one probably should pick the closest root window. | 409 // TODO(oshima): This one probably should pick the closest root window. |
407 d1->SetBounds(gfx::Rect(200, 10, 100, 100)); | 410 d1->SetBounds(gfx::Rect(200, 10, 100, 100)); |
408 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); | 411 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); |
409 } | 412 } |
410 | 413 |
411 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { | 414 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { |
412 UpdateDisplay("1000x1000,1000x1000"); | 415 UpdateDisplay("1000x1000,1000x1000"); |
413 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 416 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
414 | 417 |
415 gfx::Display display0 = | 418 gfx::Display display0 = Shell::GetAshScreen()->GetDisplayMatching( |
416 gfx::Screen::GetDisplayMatching(root_windows[0]->GetBoundsInScreen()); | 419 root_windows[0]->GetBoundsInScreen()); |
417 gfx::Display display1 = | 420 gfx::Display display1 = Shell::GetAshScreen()->GetDisplayMatching( |
418 gfx::Screen::GetDisplayMatching(root_windows[1]->GetBoundsInScreen()); | 421 root_windows[1]->GetBoundsInScreen()); |
419 EXPECT_NE(display0.id(), display1.id()); | 422 EXPECT_NE(display0.id(), display1.id()); |
420 | 423 |
421 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100)); | 424 views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100)); |
422 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); | 425 EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); |
423 | 426 |
424 // Move the window where the window spans both root windows. Since the second | 427 // Move the window where the window spans both root windows. Since the second |
425 // parameter is |display1|, the window should be shown on the secondary root. | 428 // parameter is |display1|, the window should be shown on the secondary root. |
426 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), | 429 d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), |
427 display1); | 430 display1); |
428 EXPECT_EQ("500,10 1000x100", | 431 EXPECT_EQ("500,10 1000x100", |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 | 667 |
665 aura::test::EventGenerator generator22(root_windows[1]); | 668 aura::test::EventGenerator generator22(root_windows[1]); |
666 generator22.PressKey(ui::VKEY_E, 0); | 669 generator22.PressKey(ui::VKEY_E, 0); |
667 generator22.ReleaseKey(ui::VKEY_E, 0); | 670 generator22.ReleaseKey(ui::VKEY_E, 0); |
668 EXPECT_EQ(lock_widget->GetNativeView(), focus_manager->GetFocusedWindow()); | 671 EXPECT_EQ(lock_widget->GetNativeView(), focus_manager->GetFocusedWindow()); |
669 EXPECT_EQ("abcde", UTF16ToASCII(textfield->text())); | 672 EXPECT_EQ("abcde", UTF16ToASCII(textfield->text())); |
670 } | 673 } |
671 | 674 |
672 } // namespace internal | 675 } // namespace internal |
673 } // namespace ash | 676 } // namespace ash |
OLD | NEW |