OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/mirror_window_controller.h" | 5 #include "ash/display/mirror_window_controller.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #endif | 68 #endif |
69 | 69 |
70 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorBasic) { | 70 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorBasic) { |
71 test::MirrorWindowTestApi test_api; | 71 test::MirrorWindowTestApi test_api; |
72 aura::test::TestWindowDelegate test_window_delegate; | 72 aura::test::TestWindowDelegate test_window_delegate; |
73 test_window_delegate.set_window_component(HTTOP); | 73 test_window_delegate.set_window_component(HTTOP); |
74 | 74 |
75 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 75 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
76 display_manager->SetSoftwareMirroring(true); | 76 display_manager->SetSoftwareMirroring(true); |
77 UpdateDisplay("400x400,400x400"); | 77 UpdateDisplay("400x400,400x400"); |
78 aura::RootWindow* root = Shell::GetInstance()->GetPrimaryRootWindow(); | 78 aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); |
79 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( | 79 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( |
80 &test_window_delegate, | 80 &test_window_delegate, |
81 0, | 81 0, |
82 gfx::Rect(50, 50, 100, 100), | 82 gfx::Rect(50, 50, 100, 100), |
83 root)); | 83 root)); |
84 window->Show(); | 84 window->Show(); |
85 window->SetName("foo"); | 85 window->SetName("foo"); |
86 | 86 |
87 EXPECT_TRUE(test_api.GetCursorWindow()); | 87 EXPECT_TRUE(test_api.GetCursorWindow()); |
88 EXPECT_EQ("50,50 100x100", window->bounds().ToString()); | 88 EXPECT_EQ("50,50 100x100", window->bounds().ToString()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorRotate) { | 127 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorRotate) { |
128 test::MirrorWindowTestApi test_api; | 128 test::MirrorWindowTestApi test_api; |
129 aura::test::TestWindowDelegate test_window_delegate; | 129 aura::test::TestWindowDelegate test_window_delegate; |
130 test_window_delegate.set_window_component(HTTOP); | 130 test_window_delegate.set_window_component(HTTOP); |
131 | 131 |
132 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 132 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
133 display_manager->SetSoftwareMirroring(true); | 133 display_manager->SetSoftwareMirroring(true); |
134 UpdateDisplay("400x400,400x400"); | 134 UpdateDisplay("400x400,400x400"); |
135 aura::RootWindow* root = Shell::GetInstance()->GetPrimaryRootWindow(); | 135 aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); |
136 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( | 136 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( |
137 &test_window_delegate, | 137 &test_window_delegate, |
138 0, | 138 0, |
139 gfx::Rect(50, 50, 100, 100), | 139 gfx::Rect(50, 50, 100, 100), |
140 root)); | 140 root)); |
141 window->Show(); | 141 window->Show(); |
142 window->SetName("foo"); | 142 window->SetName("foo"); |
143 | 143 |
144 EXPECT_TRUE(test_api.GetCursorWindow()); | 144 EXPECT_TRUE(test_api.GetCursorWindow()); |
145 EXPECT_EQ("50,50 100x100", window->bounds().ToString()); | 145 EXPECT_EQ("50,50 100x100", window->bounds().ToString()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // the source display's host location in the mirror root window's | 192 // the source display's host location in the mirror root window's |
193 // coordinates. | 193 // coordinates. |
194 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorLocations) { | 194 TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorLocations) { |
195 test::MirrorWindowTestApi test_api; | 195 test::MirrorWindowTestApi test_api; |
196 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 196 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
197 display_manager->SetSoftwareMirroring(true); | 197 display_manager->SetSoftwareMirroring(true); |
198 | 198 |
199 // Test with device scale factor. | 199 // Test with device scale factor. |
200 UpdateDisplay("400x600*2,400x600"); | 200 UpdateDisplay("400x600*2,400x600"); |
201 | 201 |
202 aura::RootWindow* root = Shell::GetInstance()->GetPrimaryRootWindow(); | 202 aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); |
203 aura::test::EventGenerator generator(root); | 203 aura::test::EventGenerator generator(root); |
204 generator.MoveMouseToInHost(10, 20); | 204 generator.MoveMouseToInHost(10, 20); |
205 | 205 |
206 gfx::Point hot_point = test_api.GetCursorHotPoint(); | 206 gfx::Point hot_point = test_api.GetCursorHotPoint(); |
207 EXPECT_EQ("8,9", hot_point.ToString()); | 207 EXPECT_EQ("8,9", hot_point.ToString()); |
208 gfx::Point cursor_window_origin = | 208 gfx::Point cursor_window_origin = |
209 test_api.GetCursorWindow()->bounds().origin(); | 209 test_api.GetCursorWindow()->bounds().origin(); |
210 EXPECT_EQ(10 - hot_point.x(), cursor_window_origin.x()); | 210 EXPECT_EQ(10 - hot_point.x(), cursor_window_origin.x()); |
211 EXPECT_EQ(20 - hot_point.y(), cursor_window_origin.y()); | 211 EXPECT_EQ(20 - hot_point.y(), cursor_window_origin.y()); |
212 | 212 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { | 278 TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { |
279 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 279 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
280 EXPECT_TRUE(display_manager->IsMirrored()); | 280 EXPECT_TRUE(display_manager->IsMirrored()); |
281 RunAllPendingInMessageLoop(); | 281 RunAllPendingInMessageLoop(); |
282 test::MirrorWindowTestApi test_api; | 282 test::MirrorWindowTestApi test_api; |
283 EXPECT_TRUE(test_api.GetRootWindow()); | 283 EXPECT_TRUE(test_api.GetRootWindow()); |
284 } | 284 } |
285 | 285 |
286 } // namsspace internal | 286 } // namsspace internal |
287 } // namespace ash | 287 } // namespace ash |
OLD | NEW |