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

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

Issue 2355063002: Separate ash::test::DisplayManagerTestApi from ash (Closed)
Patch Set: review comment Created 4 years, 2 months 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
OLDNEW
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_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/display/mouse_cursor_event_filter.h" 8 #include "ash/display/mouse_cursor_event_filter.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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 UpdateDisplay("360x360,700x700"); 56 UpdateDisplay("360x360,700x700");
57 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 57 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
58 int64_t display_0_id = display::Screen::GetScreen() 58 int64_t display_0_id = display::Screen::GetScreen()
59 ->GetDisplayNearestWindow(root_windows[0]) 59 ->GetDisplayNearestWindow(root_windows[0])
60 .id(); 60 .id();
61 int64_t display_1_id = display::Screen::GetScreen() 61 int64_t display_1_id = display::Screen::GetScreen()
62 ->GetDisplayNearestWindow(root_windows[1]) 62 ->GetDisplayNearestWindow(root_windows[1])
63 .id(); 63 .id();
64 64
65 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 65 std::unique_ptr<display::DisplayLayout> layout(test::CreateDisplayLayout(
66 std::unique_ptr<display::DisplayLayout> layout( 66 display_manager(), display::DisplayPlacement::RIGHT, 0));
67 test::CreateDisplayLayout(display::DisplayPlacement::RIGHT, 0));
68 67
69 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); 68 display_manager()->SetLayoutForCurrentDisplays(layout->Copy());
70 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); 69 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
71 70
72 ASSERT_EQ(1U, GetWarpRegionsCount()); 71 ASSERT_EQ(1U, GetWarpRegionsCount());
73 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));
74 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));
75 74
76 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); 75 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
77 EXPECT_EQ(gfx::Rect(359, 0, 1, 360), GetIndicatorBounds(display_0_id)); 76 EXPECT_EQ(gfx::Rect(359, 0, 1, 360), GetIndicatorBounds(display_0_id));
78 EXPECT_EQ(gfx::Rect(360, 16, 1, 344), GetIndicatorBounds(display_1_id)); 77 EXPECT_EQ(gfx::Rect(360, 16, 1, 344), GetIndicatorBounds(display_1_id));
79 78
80 // Move 2nd display downwards a bit. 79 // Move 2nd display downwards a bit.
81 layout->placement_list[0].offset = 5; 80 layout->placement_list[0].offset = 5;
82 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); 81 display_manager()->SetLayoutForCurrentDisplays(layout->Copy());
83 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); 82 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
84 // This is same as before because the 2nd display's y is above 83 // This is same as before because the 2nd display's y is above
85 // the indicator's x. 84 // the indicator's x.
86 ASSERT_EQ(1U, GetWarpRegionsCount()); 85 ASSERT_EQ(1U, GetWarpRegionsCount());
87 EXPECT_EQ(gfx::Rect(359, 16, 1, 344), GetIndicatorBounds(display_0_id)); 86 EXPECT_EQ(gfx::Rect(359, 16, 1, 344), GetIndicatorBounds(display_0_id));
88 EXPECT_EQ(gfx::Rect(360, 5, 1, 355), GetIndicatorBounds(display_1_id)); 87 EXPECT_EQ(gfx::Rect(360, 5, 1, 355), GetIndicatorBounds(display_1_id));
89 88
90 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); 89 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
91 EXPECT_EQ(gfx::Rect(359, 5, 1, 355), GetIndicatorBounds(display_0_id)); 90 EXPECT_EQ(gfx::Rect(359, 5, 1, 355), GetIndicatorBounds(display_0_id));
92 EXPECT_EQ(gfx::Rect(360, 21, 1, 339), GetIndicatorBounds(display_1_id)); 91 EXPECT_EQ(gfx::Rect(360, 21, 1, 339), GetIndicatorBounds(display_1_id));
93 92
94 // Move it down further so that the shared edge is shorter than 93 // Move it down further so that the shared edge is shorter than
95 // minimum hole size (160). 94 // minimum hole size (160).
96 layout->placement_list[0].offset = 200; 95 layout->placement_list[0].offset = 200;
97 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); 96 display_manager()->SetLayoutForCurrentDisplays(layout->Copy());
98 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); 97 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
99 ASSERT_EQ(1U, GetWarpRegionsCount()); 98 ASSERT_EQ(1U, GetWarpRegionsCount());
100 EXPECT_EQ(gfx::Rect(359, 200, 1, 160), GetIndicatorBounds(display_0_id)); 99 EXPECT_EQ(gfx::Rect(359, 200, 1, 160), GetIndicatorBounds(display_0_id));
101 EXPECT_EQ(gfx::Rect(360, 200, 1, 160), GetIndicatorBounds(display_1_id)); 100 EXPECT_EQ(gfx::Rect(360, 200, 1, 160), GetIndicatorBounds(display_1_id));
102 101
103 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); 102 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
104 ASSERT_EQ(1U, GetWarpRegionsCount()); 103 ASSERT_EQ(1U, GetWarpRegionsCount());
105 EXPECT_EQ(gfx::Rect(359, 200, 1, 160), GetIndicatorBounds(display_0_id)); 104 EXPECT_EQ(gfx::Rect(359, 200, 1, 160), GetIndicatorBounds(display_0_id));
106 EXPECT_EQ(gfx::Rect(360, 200, 1, 160), GetIndicatorBounds(display_1_id)); 105 EXPECT_EQ(gfx::Rect(360, 200, 1, 160), GetIndicatorBounds(display_1_id));
107 106
108 // Now move 2nd display upwards 107 // Now move 2nd display upwards
109 layout->placement_list[0].offset = -5; 108 layout->placement_list[0].offset = -5;
110 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); 109 display_manager()->SetLayoutForCurrentDisplays(layout->Copy());
111 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); 110 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
112 ASSERT_EQ(1U, GetWarpRegionsCount()); 111 ASSERT_EQ(1U, GetWarpRegionsCount());
113 EXPECT_EQ(gfx::Rect(359, 16, 1, 344), GetIndicatorBounds(display_0_id)); 112 EXPECT_EQ(gfx::Rect(359, 16, 1, 344), GetIndicatorBounds(display_0_id));
114 EXPECT_EQ(gfx::Rect(360, 0, 1, 360), GetIndicatorBounds(display_1_id)); 113 EXPECT_EQ(gfx::Rect(360, 0, 1, 360), GetIndicatorBounds(display_1_id));
115 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); 114 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
116 // 16 px are reserved on 2nd display from top, so y must be 115 // 16 px are reserved on 2nd display from top, so y must be
117 // (16 - 5) = 11 116 // (16 - 5) = 11
118 ASSERT_EQ(1U, GetWarpRegionsCount()); 117 ASSERT_EQ(1U, GetWarpRegionsCount());
119 EXPECT_EQ(gfx::Rect(359, 0, 1, 360), GetIndicatorBounds(display_0_id)); 118 EXPECT_EQ(gfx::Rect(359, 0, 1, 360), GetIndicatorBounds(display_0_id));
120 EXPECT_EQ(gfx::Rect(360, 11, 1, 349), GetIndicatorBounds(display_1_id)); 119 EXPECT_EQ(gfx::Rect(360, 11, 1, 349), GetIndicatorBounds(display_1_id));
121 120
122 event_filter()->HideSharedEdgeIndicator(); 121 event_filter()->HideSharedEdgeIndicator();
123 } 122 }
124 123
125 TEST_F(ExtendedMouseWarpControllerTest, IndicatorBoundsTestOnLeft) { 124 TEST_F(ExtendedMouseWarpControllerTest, IndicatorBoundsTestOnLeft) {
126 if (!SupportsMultipleDisplays()) 125 if (!SupportsMultipleDisplays())
127 return; 126 return;
128 127
129 UpdateDisplay("360x360,700x700"); 128 UpdateDisplay("360x360,700x700");
130 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 129 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
131 130
132 int64_t display_0_id = display::Screen::GetScreen() 131 int64_t display_0_id = display::Screen::GetScreen()
133 ->GetDisplayNearestWindow(root_windows[0]) 132 ->GetDisplayNearestWindow(root_windows[0])
134 .id(); 133 .id();
135 int64_t display_1_id = display::Screen::GetScreen() 134 int64_t display_1_id = display::Screen::GetScreen()
136 ->GetDisplayNearestWindow(root_windows[1]) 135 ->GetDisplayNearestWindow(root_windows[1])
137 .id(); 136 .id();
138 137
139 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 138 std::unique_ptr<display::DisplayLayout> layout(test::CreateDisplayLayout(
140 std::unique_ptr<display::DisplayLayout> layout( 139 display_manager(), display::DisplayPlacement::LEFT, 0));
141 test::CreateDisplayLayout(display::DisplayPlacement::LEFT, 0)); 140 display_manager()->SetLayoutForCurrentDisplays(layout->Copy());
142 display_manager->SetLayoutForCurrentDisplays(layout->Copy());
143 141
144 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); 142 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
145 ASSERT_EQ(1U, GetWarpRegionsCount()); 143 ASSERT_EQ(1U, GetWarpRegionsCount());
146 EXPECT_EQ(gfx::Rect(0, 16, 1, 344), GetIndicatorBounds(display_0_id)); 144 EXPECT_EQ(gfx::Rect(0, 16, 1, 344), GetIndicatorBounds(display_0_id));
147 EXPECT_EQ(gfx::Rect(-1, 0, 1, 360), GetIndicatorBounds(display_1_id)); 145 EXPECT_EQ(gfx::Rect(-1, 0, 1, 360), GetIndicatorBounds(display_1_id));
148 146
149 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); 147 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
150 ASSERT_EQ(1U, GetWarpRegionsCount()); 148 ASSERT_EQ(1U, GetWarpRegionsCount());
151 EXPECT_EQ(gfx::Rect(0, 0, 1, 360), GetIndicatorBounds(display_0_id)); 149 EXPECT_EQ(gfx::Rect(0, 0, 1, 360), GetIndicatorBounds(display_0_id));
152 EXPECT_EQ(gfx::Rect(-1, 16, 1, 344), GetIndicatorBounds(display_1_id)); 150 EXPECT_EQ(gfx::Rect(-1, 16, 1, 344), GetIndicatorBounds(display_1_id));
153 151
154 layout->placement_list[0].offset = 250; 152 layout->placement_list[0].offset = 250;
155 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); 153 display_manager()->SetLayoutForCurrentDisplays(layout->Copy());
156 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); 154 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
157 ASSERT_EQ(1U, GetWarpRegionsCount()); 155 ASSERT_EQ(1U, GetWarpRegionsCount());
158 EXPECT_EQ(gfx::Rect(0, 250, 1, 110), GetIndicatorBounds(display_0_id)); 156 EXPECT_EQ(gfx::Rect(0, 250, 1, 110), GetIndicatorBounds(display_0_id));
159 EXPECT_EQ(gfx::Rect(-1, 250, 1, 110), GetIndicatorBounds(display_1_id)); 157 EXPECT_EQ(gfx::Rect(-1, 250, 1, 110), GetIndicatorBounds(display_1_id));
160 158
161 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); 159 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
162 ASSERT_EQ(1U, GetWarpRegionsCount()); 160 ASSERT_EQ(1U, GetWarpRegionsCount());
163 EXPECT_EQ(gfx::Rect(0, 250, 1, 110), GetIndicatorBounds(display_0_id)); 161 EXPECT_EQ(gfx::Rect(0, 250, 1, 110), GetIndicatorBounds(display_0_id));
164 EXPECT_EQ(gfx::Rect(-1, 250, 1, 110), GetIndicatorBounds(display_1_id)); 162 EXPECT_EQ(gfx::Rect(-1, 250, 1, 110), GetIndicatorBounds(display_1_id));
165 163
166 event_filter()->HideSharedEdgeIndicator(); 164 event_filter()->HideSharedEdgeIndicator();
167 } 165 }
168 166
169 TEST_F(ExtendedMouseWarpControllerTest, IndicatorBoundsTestOnTopBottom) { 167 TEST_F(ExtendedMouseWarpControllerTest, IndicatorBoundsTestOnTopBottom) {
170 if (!SupportsMultipleDisplays()) 168 if (!SupportsMultipleDisplays())
171 return; 169 return;
172 170
173 UpdateDisplay("360x360,700x700"); 171 UpdateDisplay("360x360,700x700");
174 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 172 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
175 int64_t display_0_id = display::Screen::GetScreen() 173 int64_t display_0_id = display::Screen::GetScreen()
176 ->GetDisplayNearestWindow(root_windows[0]) 174 ->GetDisplayNearestWindow(root_windows[0])
177 .id(); 175 .id();
178 int64_t display_1_id = display::Screen::GetScreen() 176 int64_t display_1_id = display::Screen::GetScreen()
179 ->GetDisplayNearestWindow(root_windows[1]) 177 ->GetDisplayNearestWindow(root_windows[1])
180 .id(); 178 .id();
181 179
182 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 180 std::unique_ptr<display::DisplayLayout> layout(test::CreateDisplayLayout(
183 std::unique_ptr<display::DisplayLayout> layout( 181 display_manager(), display::DisplayPlacement::TOP, 0));
184 test::CreateDisplayLayout(display::DisplayPlacement::TOP, 0)); 182 display_manager()->SetLayoutForCurrentDisplays(layout->Copy());
185 display_manager->SetLayoutForCurrentDisplays(layout->Copy());
186 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); 183 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
187 ASSERT_EQ(1U, GetWarpRegionsCount()); 184 ASSERT_EQ(1U, GetWarpRegionsCount());
188 EXPECT_EQ(gfx::Rect(0, 0, 360, 1), GetIndicatorBounds(display_0_id)); 185 EXPECT_EQ(gfx::Rect(0, 0, 360, 1), GetIndicatorBounds(display_0_id));
189 EXPECT_EQ(gfx::Rect(0, -1, 360, 1), GetIndicatorBounds(display_1_id)); 186 EXPECT_EQ(gfx::Rect(0, -1, 360, 1), GetIndicatorBounds(display_1_id));
190 187
191 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); 188 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
192 ASSERT_EQ(1U, GetWarpRegionsCount()); 189 ASSERT_EQ(1U, GetWarpRegionsCount());
193 EXPECT_EQ(gfx::Rect(0, 0, 360, 1), GetIndicatorBounds(display_0_id)); 190 EXPECT_EQ(gfx::Rect(0, 0, 360, 1), GetIndicatorBounds(display_0_id));
194 EXPECT_EQ(gfx::Rect(0, -1, 360, 1), GetIndicatorBounds(display_1_id)); 191 EXPECT_EQ(gfx::Rect(0, -1, 360, 1), GetIndicatorBounds(display_1_id));
195 192
196 layout->placement_list[0].offset = 250; 193 layout->placement_list[0].offset = 250;
197 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); 194 display_manager()->SetLayoutForCurrentDisplays(layout->Copy());
198 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); 195 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
199 ASSERT_EQ(1U, GetWarpRegionsCount()); 196 ASSERT_EQ(1U, GetWarpRegionsCount());
200 EXPECT_EQ(gfx::Rect(250, 0, 110, 1), GetIndicatorBounds(display_0_id)); 197 EXPECT_EQ(gfx::Rect(250, 0, 110, 1), GetIndicatorBounds(display_0_id));
201 EXPECT_EQ(gfx::Rect(250, -1, 110, 1), GetIndicatorBounds(display_1_id)); 198 EXPECT_EQ(gfx::Rect(250, -1, 110, 1), GetIndicatorBounds(display_1_id));
202 199
203 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); 200 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
204 ASSERT_EQ(1U, GetWarpRegionsCount()); 201 ASSERT_EQ(1U, GetWarpRegionsCount());
205 EXPECT_EQ(gfx::Rect(250, 0, 110, 1), GetIndicatorBounds(display_0_id)); 202 EXPECT_EQ(gfx::Rect(250, 0, 110, 1), GetIndicatorBounds(display_0_id));
206 EXPECT_EQ(gfx::Rect(250, -1, 110, 1), GetIndicatorBounds(display_1_id)); 203 EXPECT_EQ(gfx::Rect(250, -1, 110, 1), GetIndicatorBounds(display_1_id));
207 204
208 layout->placement_list[0].position = display::DisplayPlacement::BOTTOM; 205 layout->placement_list[0].position = display::DisplayPlacement::BOTTOM;
209 layout->placement_list[0].offset = 0; 206 layout->placement_list[0].offset = 0;
210 display_manager->SetLayoutForCurrentDisplays(layout->Copy()); 207 display_manager()->SetLayoutForCurrentDisplays(layout->Copy());
211 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); 208 event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */);
212 ASSERT_EQ(1U, GetWarpRegionsCount()); 209 ASSERT_EQ(1U, GetWarpRegionsCount());
213 EXPECT_EQ(gfx::Rect(0, 359, 360, 1), GetIndicatorBounds(display_0_id)); 210 EXPECT_EQ(gfx::Rect(0, 359, 360, 1), GetIndicatorBounds(display_0_id));
214 EXPECT_EQ(gfx::Rect(0, 360, 360, 1), GetIndicatorBounds(display_1_id)); 211 EXPECT_EQ(gfx::Rect(0, 360, 360, 1), GetIndicatorBounds(display_1_id));
215 212
216 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */); 213 event_filter()->ShowSharedEdgeIndicator(root_windows[1] /* secondary */);
217 ASSERT_EQ(1U, GetWarpRegionsCount()); 214 ASSERT_EQ(1U, GetWarpRegionsCount());
218 EXPECT_EQ(gfx::Rect(0, 359, 360, 1), GetIndicatorBounds(display_0_id)); 215 EXPECT_EQ(gfx::Rect(0, 359, 360, 1), GetIndicatorBounds(display_0_id));
219 EXPECT_EQ(gfx::Rect(0, 360, 360, 1), GetIndicatorBounds(display_1_id)); 216 EXPECT_EQ(gfx::Rect(0, 360, 360, 1), GetIndicatorBounds(display_1_id));
220 217
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // | 0 | 1 | 291 // | 0 | 1 |
295 // +-+---+--++ 292 // +-+---+--++
296 // | 2 | 293 // | 2 |
297 // +------+ 294 // +------+
298 display::DisplayLayoutBuilder builder(display_0_id); 295 display::DisplayLayoutBuilder builder(display_0_id);
299 builder.AddDisplayPlacement(display_1_id, display_0_id, 296 builder.AddDisplayPlacement(display_1_id, display_0_id,
300 display::DisplayPlacement::RIGHT, 0); 297 display::DisplayPlacement::RIGHT, 0);
301 builder.AddDisplayPlacement(display_2_id, display_0_id, 298 builder.AddDisplayPlacement(display_2_id, display_0_id,
302 display::DisplayPlacement::BOTTOM, 100); 299 display::DisplayPlacement::BOTTOM, 100);
303 300
304 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 301 display_manager()->SetLayoutForCurrentDisplays(builder.Build());
305 display_manager->SetLayoutForCurrentDisplays(builder.Build());
306 ASSERT_EQ(3U, GetWarpRegionsCount()); 302 ASSERT_EQ(3U, GetWarpRegionsCount());
307 303
308 // Drag from 0. 304 // Drag from 0.
309 event_filter()->ShowSharedEdgeIndicator(root_windows[0]); 305 event_filter()->ShowSharedEdgeIndicator(root_windows[0]);
310 ASSERT_EQ(3U, GetWarpRegionsCount()); 306 ASSERT_EQ(3U, GetWarpRegionsCount());
311 const ExtendedMouseWarpController::WarpRegion* region_0 = GetWarpRegion(0); 307 const ExtendedMouseWarpController::WarpRegion* region_0 = GetWarpRegion(0);
312 const ExtendedMouseWarpController::WarpRegion* region_1 = GetWarpRegion(1); 308 const ExtendedMouseWarpController::WarpRegion* region_1 = GetWarpRegion(1);
313 const ExtendedMouseWarpController::WarpRegion* region_2 = GetWarpRegion(2); 309 const ExtendedMouseWarpController::WarpRegion* region_2 = GetWarpRegion(2);
314 // between 2 and 0 310 // between 2 and 0
315 EXPECT_EQ(gfx::Rect(100, 499, 600, 1), 311 EXPECT_EQ(gfx::Rect(100, 499, 600, 1),
(...skipping 29 matching lines...) Expand all
345 // | 0 | |1 | 341 // | 0 | |1 |
346 // +-+---+-+++ 342 // +-+---+-+++
347 // | 2 | 343 // | 2 |
348 // +------+ 344 // +------+
349 display::DisplayLayoutBuilder builder(display_0_id); 345 display::DisplayLayoutBuilder builder(display_0_id);
350 builder.AddDisplayPlacement(display_2_id, display_0_id, 346 builder.AddDisplayPlacement(display_2_id, display_0_id,
351 display::DisplayPlacement::BOTTOM, 100); 347 display::DisplayPlacement::BOTTOM, 100);
352 builder.AddDisplayPlacement(display_1_id, display_2_id, 348 builder.AddDisplayPlacement(display_1_id, display_2_id,
353 display::DisplayPlacement::TOP, 800); 349 display::DisplayPlacement::TOP, 800);
354 350
355 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 351 display_manager()->SetLayoutForCurrentDisplays(builder.Build());
356 display_manager->SetLayoutForCurrentDisplays(builder.Build());
357 ASSERT_EQ(2U, GetWarpRegionsCount()); 352 ASSERT_EQ(2U, GetWarpRegionsCount());
358 353
359 // Drag from 0. 354 // Drag from 0.
360 event_filter()->ShowSharedEdgeIndicator(root_windows[0]); 355 event_filter()->ShowSharedEdgeIndicator(root_windows[0]);
361 ASSERT_EQ(2U, GetWarpRegionsCount()); 356 ASSERT_EQ(2U, GetWarpRegionsCount());
362 const ExtendedMouseWarpController::WarpRegion* region_0 = GetWarpRegion(0); 357 const ExtendedMouseWarpController::WarpRegion* region_0 = GetWarpRegion(0);
363 const ExtendedMouseWarpController::WarpRegion* region_1 = GetWarpRegion(1); 358 const ExtendedMouseWarpController::WarpRegion* region_1 = GetWarpRegion(1);
364 // between 2 and 0 359 // between 2 and 0
365 EXPECT_EQ(gfx::Rect(100, 499, 600, 1), 360 EXPECT_EQ(gfx::Rect(100, 499, 600, 1),
366 region_0->GetIndicatorBoundsForTest(display_0_id)); 361 region_0->GetIndicatorBoundsForTest(display_0_id));
367 EXPECT_EQ(gfx::Rect(100, 500, 600, 1), 362 EXPECT_EQ(gfx::Rect(100, 500, 600, 1),
368 region_0->GetIndicatorBoundsForTest(display_2_id)); 363 region_0->GetIndicatorBoundsForTest(display_2_id));
369 // between 2 and 1 364 // between 2 and 1
370 EXPECT_EQ(gfx::Rect(900, 499, 200, 1), 365 EXPECT_EQ(gfx::Rect(900, 499, 200, 1),
371 region_1->GetIndicatorBoundsForTest(display_1_id)); 366 region_1->GetIndicatorBoundsForTest(display_1_id));
372 EXPECT_EQ(gfx::Rect(900, 500, 200, 1), 367 EXPECT_EQ(gfx::Rect(900, 500, 200, 1),
373 region_1->GetIndicatorBoundsForTest(display_2_id)); 368 region_1->GetIndicatorBoundsForTest(display_2_id));
374 event_filter()->HideSharedEdgeIndicator(); 369 event_filter()->HideSharedEdgeIndicator();
375 } 370 }
376 371
377 } // namespace ash 372 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/extended_mouse_warp_controller.cc ('k') | ash/display/mirror_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698