OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extended_mouse_warp_controller.h" | 5 #include "ash/display/extended_mouse_warp_controller.h" |
6 | 6 |
7 #include "ash/display/display_layout_store.h" | 7 #include "ash/display/display_layout_store.h" |
8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
9 #include "ash/display/mouse_cursor_event_filter.h" | 9 #include "ash/display/mouse_cursor_event_filter.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return; | 55 return; |
56 | 56 |
57 UpdateDisplay("360x360,700x700"); | 57 UpdateDisplay("360x360,700x700"); |
58 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 58 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
59 int64_t display_0_id = | 59 int64_t display_0_id = |
60 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[0]).id(); | 60 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[0]).id(); |
61 int64_t display_1_id = | 61 int64_t display_1_id = |
62 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[1]).id(); | 62 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[1]).id(); |
63 | 63 |
64 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 64 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
65 scoped_ptr<display::DisplayLayout> layout( | 65 std::unique_ptr<display::DisplayLayout> layout( |
66 test::CreateDisplayLayout(display::DisplayPlacement::RIGHT, 0)); | 66 test::CreateDisplayLayout(display::DisplayPlacement::RIGHT, 0)); |
67 | 67 |
68 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); | 68 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); |
69 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); | 69 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); |
70 | 70 |
71 ASSERT_EQ(1U, GetWarpRegionsCount()); | 71 ASSERT_EQ(1U, GetWarpRegionsCount()); |
72 EXPECT_EQ(gfx::Rect(359, 16, 1, 344), GetIndicatorBounds(display_0_id)); | 72 EXPECT_EQ(gfx::Rect(359, 16, 1, 344), GetIndicatorBounds(display_0_id)); |
73 EXPECT_EQ(gfx::Rect(360, 0, 1, 360), GetIndicatorBounds(display_1_id)); | 73 EXPECT_EQ(gfx::Rect(360, 0, 1, 360), GetIndicatorBounds(display_1_id)); |
74 | 74 |
75 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); | 75 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 UpdateDisplay("360x360,700x700"); | 128 UpdateDisplay("360x360,700x700"); |
129 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 129 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
130 | 130 |
131 int64_t display_0_id = | 131 int64_t display_0_id = |
132 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[0]).id(); | 132 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[0]).id(); |
133 int64_t display_1_id = | 133 int64_t display_1_id = |
134 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[1]).id(); | 134 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[1]).id(); |
135 | 135 |
136 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 136 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
137 scoped_ptr<display::DisplayLayout> layout( | 137 std::unique_ptr<display::DisplayLayout> layout( |
138 test::CreateDisplayLayout(display::DisplayPlacement::LEFT, 0)); | 138 test::CreateDisplayLayout(display::DisplayPlacement::LEFT, 0)); |
139 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); | 139 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); |
140 | 140 |
141 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); | 141 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); |
142 ASSERT_EQ(1U, GetWarpRegionsCount()); | 142 ASSERT_EQ(1U, GetWarpRegionsCount()); |
143 EXPECT_EQ(gfx::Rect(0, 16, 1, 344), GetIndicatorBounds(display_0_id)); | 143 EXPECT_EQ(gfx::Rect(0, 16, 1, 344), GetIndicatorBounds(display_0_id)); |
144 EXPECT_EQ(gfx::Rect(-1, 0, 1, 360), GetIndicatorBounds(display_1_id)); | 144 EXPECT_EQ(gfx::Rect(-1, 0, 1, 360), GetIndicatorBounds(display_1_id)); |
145 | 145 |
146 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); | 146 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); |
147 ASSERT_EQ(1U, GetWarpRegionsCount()); | 147 ASSERT_EQ(1U, GetWarpRegionsCount()); |
(...skipping 20 matching lines...) Expand all Loading... |
168 return; | 168 return; |
169 | 169 |
170 UpdateDisplay("360x360,700x700"); | 170 UpdateDisplay("360x360,700x700"); |
171 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 171 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
172 int64_t display_0_id = | 172 int64_t display_0_id = |
173 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[0]).id(); | 173 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[0]).id(); |
174 int64_t display_1_id = | 174 int64_t display_1_id = |
175 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[1]).id(); | 175 gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[1]).id(); |
176 | 176 |
177 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 177 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
178 scoped_ptr<display::DisplayLayout> layout( | 178 std::unique_ptr<display::DisplayLayout> layout( |
179 test::CreateDisplayLayout(display::DisplayPlacement::TOP, 0)); | 179 test::CreateDisplayLayout(display::DisplayPlacement::TOP, 0)); |
180 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); | 180 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); |
181 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); | 181 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); |
182 ASSERT_EQ(1U, GetWarpRegionsCount()); | 182 ASSERT_EQ(1U, GetWarpRegionsCount()); |
183 EXPECT_EQ(gfx::Rect(0, 0, 360, 1), GetIndicatorBounds(display_0_id)); | 183 EXPECT_EQ(gfx::Rect(0, 0, 360, 1), GetIndicatorBounds(display_0_id)); |
184 EXPECT_EQ(gfx::Rect(0, -1, 360, 1), GetIndicatorBounds(display_1_id)); | 184 EXPECT_EQ(gfx::Rect(0, -1, 360, 1), GetIndicatorBounds(display_1_id)); |
185 | 185 |
186 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); | 186 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); |
187 ASSERT_EQ(1U, GetWarpRegionsCount()); | 187 ASSERT_EQ(1U, GetWarpRegionsCount()); |
188 EXPECT_EQ(gfx::Rect(0, 0, 360, 1), GetIndicatorBounds(display_0_id)); | 188 EXPECT_EQ(gfx::Rect(0, 0, 360, 1), GetIndicatorBounds(display_0_id)); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 region_0->GetIndicatorBoundsForTest(display_2_id)); | 363 region_0->GetIndicatorBoundsForTest(display_2_id)); |
364 // between 2 and 1 | 364 // between 2 and 1 |
365 EXPECT_EQ(gfx::Rect(900, 499, 200, 1), | 365 EXPECT_EQ(gfx::Rect(900, 499, 200, 1), |
366 region_1->GetIndicatorBoundsForTest(display_1_id)); | 366 region_1->GetIndicatorBoundsForTest(display_1_id)); |
367 EXPECT_EQ(gfx::Rect(900, 500, 200, 1), | 367 EXPECT_EQ(gfx::Rect(900, 500, 200, 1), |
368 region_1->GetIndicatorBoundsForTest(display_2_id)); | 368 region_1->GetIndicatorBoundsForTest(display_2_id)); |
369 event_filter()->HideSharedEdgeIndicator(); | 369 event_filter()->HideSharedEdgeIndicator(); |
370 } | 370 } |
371 | 371 |
372 } // namespace ash | 372 } // namespace ash |
OLD | NEW |