Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: ash/display/display_manager_unittest.cc

Issue 64933002: Eliminate Shell::RootWindowList in favor of aura::Window::Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/display_layout_store.h" 8 #include "ash/display/display_layout_store.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 // Tests that rely on the actual host size/location does not work on windows. 598 // Tests that rely on the actual host size/location does not work on windows.
599 #define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays 599 #define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays
600 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft DISABLED_EnsurePointerInDisplays _2ndOnLeft 600 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft DISABLED_EnsurePointerInDisplays _2ndOnLeft
601 #else 601 #else
602 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays 602 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays
603 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft EnsurePointerInDisplays_2ndOnLef t 603 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft EnsurePointerInDisplays_2ndOnLef t
604 #endif 604 #endif
605 605
606 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) { 606 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) {
607 UpdateDisplay("200x200,300x300"); 607 UpdateDisplay("200x200,300x300");
608 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 608 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
609 609
610 aura::Env* env = aura::Env::GetInstance(); 610 aura::Env* env = aura::Env::GetInstance();
611 611
612 aura::test::EventGenerator generator(root_windows[0]); 612 aura::test::EventGenerator generator(root_windows[0]);
613 613
614 // Set the initial position. 614 // Set the initial position.
615 generator.MoveMouseToInHost(350, 150); 615 generator.MoveMouseToInHost(350, 150);
616 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); 616 EXPECT_EQ("350,150", env->last_mouse_location().ToString());
617 617
618 // A mouse pointer will stay in the 2nd display. 618 // A mouse pointer will stay in the 2nd display.
(...skipping 26 matching lines...) Expand all
645 645
646 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) { 646 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) {
647 // Set the 2nd display on the left. 647 // Set the 2nd display on the left.
648 DisplayLayoutStore* layout_store = 648 DisplayLayoutStore* layout_store =
649 Shell::GetInstance()->display_manager()->layout_store(); 649 Shell::GetInstance()->display_manager()->layout_store();
650 DisplayLayout layout = layout_store->default_display_layout(); 650 DisplayLayout layout = layout_store->default_display_layout();
651 layout.position = DisplayLayout::LEFT; 651 layout.position = DisplayLayout::LEFT;
652 layout_store->SetDefaultDisplayLayout(layout); 652 layout_store->SetDefaultDisplayLayout(layout);
653 653
654 UpdateDisplay("200x200,300x300"); 654 UpdateDisplay("200x200,300x300");
655 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 655 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
656 656
657 EXPECT_EQ("-300,0 300x300", 657 EXPECT_EQ("-300,0 300x300",
658 ScreenAsh::GetSecondaryDisplay().bounds().ToString()); 658 ScreenAsh::GetSecondaryDisplay().bounds().ToString());
659 659
660 aura::Env* env = aura::Env::GetInstance(); 660 aura::Env* env = aura::Env::GetInstance();
661 661
662 // Set the initial position. 662 // Set the initial position.
663 root_windows[0]->MoveCursorTo(gfx::Point(-150, 250)); 663 root_windows[0]->MoveCursorTo(gfx::Point(-150, 250));
664 EXPECT_EQ("-150,250", env->last_mouse_location().ToString()); 664 EXPECT_EQ("-150,250", env->last_mouse_location().ToString());
665 665
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 // TODO(scottmg): RootWindow doesn't get resized on Windows 874 // TODO(scottmg): RootWindow doesn't get resized on Windows
875 // Ash. http://crbug.com/247916. 875 // Ash. http://crbug.com/247916.
876 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo tateZoom 876 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo tateZoom
877 #else 877 #else
878 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom 878 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom
879 #endif 879 #endif
880 880
881 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) { 881 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) {
882 // Make sure just rotating will not change native location. 882 // Make sure just rotating will not change native location.
883 UpdateDisplay("300x200,200x150"); 883 UpdateDisplay("300x200,200x150");
884 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 884 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
885 aura::Env* env = aura::Env::GetInstance(); 885 aura::Env* env = aura::Env::GetInstance();
886 886
887 aura::test::EventGenerator generator1(root_windows[0]); 887 aura::test::EventGenerator generator1(root_windows[0]);
888 aura::test::EventGenerator generator2(root_windows[1]); 888 aura::test::EventGenerator generator2(root_windows[1]);
889 889
890 // Test on 1st display. 890 // Test on 1st display.
891 generator1.MoveMouseToInHost(150, 50); 891 generator1.MoveMouseToInHost(150, 50);
892 EXPECT_EQ("150,50", env->last_mouse_location().ToString()); 892 EXPECT_EQ("150,50", env->last_mouse_location().ToString());
893 UpdateDisplay("300x200/r,200x150"); 893 UpdateDisplay("300x200/r,200x150");
894 EXPECT_EQ("50,149", env->last_mouse_location().ToString()); 894 EXPECT_EQ("50,149", env->last_mouse_location().ToString());
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 // TODO(scottmg): RootWindow doesn't get resized on Windows 1073 // TODO(scottmg): RootWindow doesn't get resized on Windows
1074 // Ash. http://crbug.com/247916. 1074 // Ash. http://crbug.com/247916.
1075 #define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin 1075 #define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin
1076 #else 1076 #else
1077 #define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin 1077 #define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin
1078 #endif 1078 #endif
1079 1079
1080 TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) { 1080 TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) {
1081 UpdateDisplay("100x200,300x400"); 1081 UpdateDisplay("100x200,300x400");
1082 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1082 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
1083 Shell::RootWindowList root_windows = 1083 aura::Window::Windows root_windows =
1084 Shell::GetInstance()->GetAllRootWindows(); 1084 Shell::GetInstance()->GetAllRootWindows();
1085 ASSERT_EQ(2U, root_windows.size()); 1085 ASSERT_EQ(2U, root_windows.size());
1086 EXPECT_EQ("1,1", root_windows[0]->GetHostOrigin().ToString()); 1086 aura::WindowEventDispatcher* dispatcher0 = root_windows[0]->GetDispatcher();
1087 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); 1087 aura::WindowEventDispatcher* dispatcher1 = root_windows[1]->GetDispatcher();
1088
1089 EXPECT_EQ("1,1", dispatcher0->GetHostOrigin().ToString());
1090 EXPECT_EQ("100x200", dispatcher0->GetHostSize().ToString());
1088 // UpdateDisplay set the origin if it's not set. 1091 // UpdateDisplay set the origin if it's not set.
1089 EXPECT_NE("1,1", root_windows[1]->GetHostOrigin().ToString()); 1092 EXPECT_NE("1,1", dispatcher1->GetHostOrigin().ToString());
1090 EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); 1093 EXPECT_EQ("300x400", dispatcher1->GetHostSize().ToString());
1091 1094
1092 UpdateDisplay("100x200,200+300-300x400"); 1095 UpdateDisplay("100x200,200+300-300x400");
1093 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1096 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
1094 EXPECT_EQ("0,0", root_windows[0]->GetHostOrigin().ToString()); 1097 EXPECT_EQ("0,0", dispatcher0->GetHostOrigin().ToString());
1095 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); 1098 EXPECT_EQ("100x200", dispatcher0->GetHostSize().ToString());
1096 EXPECT_EQ("200,300", root_windows[1]->GetHostOrigin().ToString()); 1099 EXPECT_EQ("200,300", dispatcher1->GetHostOrigin().ToString());
1097 EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); 1100 EXPECT_EQ("300x400", dispatcher1->GetHostSize().ToString());
1098 1101
1099 UpdateDisplay("400+500-200x300,300x400"); 1102 UpdateDisplay("400+500-200x300,300x400");
1100 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1103 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
1101 EXPECT_EQ("400,500", root_windows[0]->GetHostOrigin().ToString()); 1104 EXPECT_EQ("400,500", dispatcher0->GetHostOrigin().ToString());
1102 EXPECT_EQ("200x300", root_windows[0]->GetHostSize().ToString()); 1105 EXPECT_EQ("200x300", dispatcher0->GetHostSize().ToString());
1103 EXPECT_EQ("0,0", root_windows[1]->GetHostOrigin().ToString()); 1106 EXPECT_EQ("0,0", dispatcher1->GetHostOrigin().ToString());
1104 EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); 1107 EXPECT_EQ("300x400", dispatcher1->GetHostSize().ToString());
1105 1108
1106 UpdateDisplay("100+200-100x200,300+500-200x300"); 1109 UpdateDisplay("100+200-100x200,300+500-200x300");
1107 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); 1110 ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays());
1108 EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString()); 1111 EXPECT_EQ("100,200", dispatcher0->GetHostOrigin().ToString());
1109 EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); 1112 EXPECT_EQ("100x200", dispatcher0->GetHostSize().ToString());
1110 EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString()); 1113 EXPECT_EQ("300,500", dispatcher1->GetHostOrigin().ToString());
1111 EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString()); 1114 EXPECT_EQ("200x300", dispatcher1->GetHostSize().ToString());
1112 } 1115 }
1113 1116
1114 } // namespace internal 1117 } // namespace internal
1115 } // namespace ash 1118 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698