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_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/screen_ash.h" | 8 #include "ash/screen_ash.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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 private: | 89 private: |
90 vector<gfx::Display> changed_; | 90 vector<gfx::Display> changed_; |
91 vector<gfx::Display> added_; | 91 vector<gfx::Display> added_; |
92 size_t removed_count_; | 92 size_t removed_count_; |
93 bool root_window_destroyed_; | 93 bool root_window_destroyed_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest); | 95 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest); |
96 }; | 96 }; |
97 | 97 |
98 TEST_F(DisplayManagerTest, NativeDisplayTest) { | 98 #if defined(OS_CHROMEOS) |
| 99 // TODO(oshima): This fails with non extended desktop on windows. |
| 100 // Reenable when extended desktop is enabled by default. |
| 101 #define MAYBE_NativeDisplayTest NativeDisplayTest |
| 102 #define MAYBE_EmulatorTest EmulatorTest |
| 103 #define MAYBE_OverscanInsetsTest OverscanInsetsTest |
| 104 #define MAYBE_ZeroOverscanInsets ZeroOverscanInsets |
| 105 #else |
| 106 #define MAYBE_NativeDisplayTest DISABLED_NativeDisplayTest |
| 107 #define MAYBE_EmulatorTest DISABLED_EmulatorTest |
| 108 #define MAYBE_OverscanInsetsTest DISABLED_OverscanInsetsTest |
| 109 #define MAYBE_ZeroOverscanInsets DISABLED_ZeroOverscanInsets |
| 110 #endif |
| 111 |
| 112 TEST_F(DisplayManagerTest, MAYBE_NativeDisplayTest) { |
99 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 113 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
100 | 114 |
101 // Update primary and add seconary. | 115 // Update primary and add seconary. |
102 UpdateDisplay("100+0-500x500,0+501-400x400"); | 116 UpdateDisplay("100+0-500x500,0+501-400x400"); |
103 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 117 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
104 EXPECT_EQ("0,0 500x500", | 118 EXPECT_EQ("0,0 500x500", |
105 display_manager()->GetDisplayAt(0)->bounds().ToString()); | 119 display_manager()->GetDisplayAt(0)->bounds().ToString()); |
106 | 120 |
107 EXPECT_EQ("1 1 0", GetCountSummary()); | 121 EXPECT_EQ("1 1 0", GetCountSummary()); |
108 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); | 122 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); |
109 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id()); | 123 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id()); |
110 EXPECT_EQ("0,0 500x500", changed()[0].bounds().ToString()); | 124 EXPECT_EQ("0,0 500x500", changed()[0].bounds().ToString()); |
111 // Secondary display is on right. | 125 // Secondary display is on right. |
112 EXPECT_EQ("500,0 400x400", added()[0].bounds().ToString()); | 126 EXPECT_EQ("500,0 400x400", added()[0].bounds().ToString()); |
113 EXPECT_EQ("0,501 400x400", added()[0].bounds_in_pixel().ToString()); | 127 EXPECT_EQ("0,501 400x400", added()[0].bounds_in_pixel().ToString()); |
114 reset(); | 128 reset(); |
115 | 129 |
116 // Delete secondary. | 130 // Delete secondary. |
117 UpdateDisplay("100+0-500x500"); | 131 UpdateDisplay("100+0-500x500"); |
118 EXPECT_EQ("0 0 1", GetCountSummary()); | 132 EXPECT_EQ("0 0 1", GetCountSummary()); |
119 reset(); | 133 reset(); |
120 | 134 |
121 // Change primary. | 135 // Change primary. |
122 UpdateDisplay("1+1-1000x600"); | 136 UpdateDisplay("0+0-1000x600"); |
123 EXPECT_EQ("1 0 0", GetCountSummary()); | 137 EXPECT_EQ("1 0 0", GetCountSummary()); |
124 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); | 138 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); |
125 EXPECT_EQ("0,0 1000x600", changed()[0].bounds().ToString()); | 139 EXPECT_EQ("0,0 1000x600", changed()[0].bounds().ToString()); |
126 reset(); | 140 reset(); |
127 | 141 |
128 // Add secondary. | 142 // Add secondary. |
129 UpdateDisplay("1+1-1000x600,1002+0-600x400"); | 143 UpdateDisplay("0+0-1000x600,1001+0-600x400"); |
130 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 144 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
131 EXPECT_EQ("0 1 0", GetCountSummary()); | 145 EXPECT_EQ("0 1 0", GetCountSummary()); |
132 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id()); | 146 EXPECT_EQ(display_manager()->GetDisplayAt(1)->id(), added()[0].id()); |
133 // Secondary display is on right. | 147 // Secondary display is on right. |
134 EXPECT_EQ("1000,0 600x400", added()[0].bounds().ToString()); | 148 EXPECT_EQ("1000,0 600x400", added()[0].bounds().ToString()); |
135 EXPECT_EQ("1002,0 600x400", added()[0].bounds_in_pixel().ToString()); | 149 EXPECT_EQ("1001,0 600x400", added()[0].bounds_in_pixel().ToString()); |
136 reset(); | 150 reset(); |
137 | 151 |
138 // Secondary removed, primary changed. | 152 // Secondary removed, primary changed. |
139 UpdateDisplay("1+1-800x300"); | 153 UpdateDisplay("0+0-800x300"); |
140 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 154 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
141 EXPECT_EQ("1 0 1", GetCountSummary()); | 155 EXPECT_EQ("1 0 1", GetCountSummary()); |
142 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); | 156 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); |
143 EXPECT_EQ("0,0 800x300", changed()[0].bounds().ToString()); | 157 EXPECT_EQ("0,0 800x300", changed()[0].bounds().ToString()); |
144 reset(); | 158 reset(); |
145 | 159 |
146 // # of display can go to zero when screen is off. | 160 // # of display can go to zero when screen is off. |
147 const vector<gfx::Display> empty; | 161 const vector<gfx::Display> empty; |
148 display_manager()->OnNativeDisplaysChanged(empty); | 162 display_manager()->OnNativeDisplaysChanged(empty); |
149 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 163 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
(...skipping 26 matching lines...) Expand all Loading... |
176 display_manager()->GetDisplayAt(0)->bounds().ToString()); | 190 display_manager()->GetDisplayAt(0)->bounds().ToString()); |
177 // Secondary display is on right. | 191 // Secondary display is on right. |
178 EXPECT_EQ("1000,0 600x400", | 192 EXPECT_EQ("1000,0 600x400", |
179 display_manager()->GetDisplayAt(1)->bounds().ToString()); | 193 display_manager()->GetDisplayAt(1)->bounds().ToString()); |
180 EXPECT_EQ("1000,1000 600x400", | 194 EXPECT_EQ("1000,1000 600x400", |
181 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); | 195 display_manager()->GetDisplayAt(1)->bounds_in_pixel().ToString()); |
182 reset(); | 196 reset(); |
183 } | 197 } |
184 | 198 |
185 // Test in emulation mode (use_fullscreen_host_window=false) | 199 // Test in emulation mode (use_fullscreen_host_window=false) |
186 TEST_F(DisplayManagerTest, EmulatorTest) { | 200 TEST_F(DisplayManagerTest, MAYBE_EmulatorTest) { |
187 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 201 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
188 | 202 |
189 DisplayManager::CycleDisplay(); | 203 DisplayManager::CycleDisplay(); |
190 // Update primary and add seconary. | 204 // Update primary and add seconary. |
191 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 205 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
192 EXPECT_EQ("0 1 0", GetCountSummary()); | 206 EXPECT_EQ("0 1 0", GetCountSummary()); |
193 reset(); | 207 reset(); |
194 | 208 |
195 DisplayManager::CycleDisplay(); | 209 DisplayManager::CycleDisplay(); |
196 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 210 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
197 EXPECT_EQ("0 0 1", GetCountSummary()); | 211 EXPECT_EQ("0 0 1", GetCountSummary()); |
198 reset(); | 212 reset(); |
199 | 213 |
200 DisplayManager::CycleDisplay(); | 214 DisplayManager::CycleDisplay(); |
201 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); | 215 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); |
202 EXPECT_EQ("0 1 0", GetCountSummary()); | 216 EXPECT_EQ("0 1 0", GetCountSummary()); |
203 reset(); | 217 reset(); |
204 } | 218 } |
205 | 219 |
206 TEST_F(DisplayManagerTest, OverscanInsetsTest) { | 220 TEST_F(DisplayManagerTest, MAYBE_OverscanInsetsTest) { |
207 UpdateDisplay("0+0-500x500,0+501-400x400"); | 221 UpdateDisplay("0+0-500x500,0+501-400x400"); |
208 reset(); | 222 reset(); |
209 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); | 223 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); |
210 gfx::Display display1(*display_manager()->GetDisplayAt(0)); | 224 gfx::Display display1(*display_manager()->GetDisplayAt(0)); |
211 gfx::Display display2(*display_manager()->GetDisplayAt(1)); | 225 gfx::Display display2(*display_manager()->GetDisplayAt(1)); |
212 | 226 |
213 display_manager()->SetOverscanInsets( | 227 display_manager()->SetOverscanInsets( |
214 display2.id(), gfx::Insets(13, 12, 11, 10)); | 228 display2.id(), gfx::Insets(13, 12, 11, 10)); |
215 std::vector<gfx::Display> changed_displays = changed(); | 229 std::vector<gfx::Display> changed_displays = changed(); |
216 EXPECT_EQ(1u, changed_displays.size()); | 230 EXPECT_EQ(1u, changed_displays.size()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 284 |
271 // Make sure switching primary display applies the overscan offset only once. | 285 // Make sure switching primary display applies the overscan offset only once. |
272 ash::Shell::GetInstance()->display_controller()->SetPrimaryDisplay( | 286 ash::Shell::GetInstance()->display_controller()->SetPrimaryDisplay( |
273 ScreenAsh::GetSecondaryDisplay()); | 287 ScreenAsh::GetSecondaryDisplay()); |
274 EXPECT_EQ("0,0 500x500", | 288 EXPECT_EQ("0,0 500x500", |
275 ScreenAsh::GetSecondaryDisplay().bounds_in_pixel().ToString()); | 289 ScreenAsh::GetSecondaryDisplay().bounds_in_pixel().ToString()); |
276 EXPECT_EQ("10,509 376x380", gfx::Screen::GetNativeScreen()-> | 290 EXPECT_EQ("10,509 376x380", gfx::Screen::GetNativeScreen()-> |
277 GetPrimaryDisplay().bounds_in_pixel().ToString()); | 291 GetPrimaryDisplay().bounds_in_pixel().ToString()); |
278 } | 292 } |
279 | 293 |
280 TEST_F(DisplayManagerTest, ZeroOverscanInsets) { | 294 TEST_F(DisplayManagerTest, MAYBE_ZeroOverscanInsets) { |
281 // Make sure the display change events is emitted for overscan inset changes. | 295 // Make sure the display change events is emitted for overscan inset changes. |
282 UpdateDisplay("0+0-500x500,0+501-400x400"); | 296 UpdateDisplay("0+0-500x500,0+501-400x400"); |
283 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); | 297 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); |
284 int64 display2_id = display_manager()->GetDisplayAt(1)->id(); | 298 int64 display2_id = display_manager()->GetDisplayAt(1)->id(); |
285 | 299 |
286 reset(); | 300 reset(); |
287 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); | 301 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); |
288 EXPECT_EQ(0u, changed().size()); | 302 EXPECT_EQ(0u, changed().size()); |
289 | 303 |
290 reset(); | 304 reset(); |
291 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(1, 0, 0, 0)); | 305 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(1, 0, 0, 0)); |
292 EXPECT_EQ(1u, changed().size()); | 306 EXPECT_EQ(1u, changed().size()); |
293 EXPECT_EQ(display2_id, changed()[0].id()); | 307 EXPECT_EQ(display2_id, changed()[0].id()); |
294 | 308 |
295 reset(); | 309 reset(); |
296 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); | 310 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); |
297 EXPECT_EQ(1u, changed().size()); | 311 EXPECT_EQ(1u, changed().size()); |
298 EXPECT_EQ(display2_id, changed()[0].id()); | 312 EXPECT_EQ(display2_id, changed()[0].id()); |
299 } | 313 } |
300 | 314 |
301 TEST_F(DisplayManagerTest, TestDeviceScaleOnlyChange) { | 315 // TODO(oshima): Device scale factor is supported on chromeos only for now. |
| 316 #if defined(OS_CHROMEOS) |
| 317 #define MAYBE_TestDeviceScaleOnlyChange TestDeviceScaleOnlyChange |
| 318 #define MAYBE_TestNativeDisplaysChanged TestNativeDisplaysChanged |
| 319 #define MAYBE_NativeDisplaysChangedAfterPrimaryChange \ |
| 320 NativeDisplaysChangedAfterPrimaryChange |
| 321 #else |
| 322 #define MAYBE_TestDeviceScaleOnlyChange DISABLED_TestDeviceScaleOnlyChange |
| 323 #define MAYBE_TestNativeDisplaysChanged DISABLED_TestNativeDisplaysChanged |
| 324 #define MAYBE_NativeDisplaysChangedAfterPrimaryChange \ |
| 325 DISABLED_NativeDisplaysChangedAfterPrimaryChange |
| 326 #endif |
| 327 |
| 328 TEST_F(DisplayManagerTest, MAYBE_TestDeviceScaleOnlyChange) { |
302 UpdateDisplay("1000x600"); | 329 UpdateDisplay("1000x600"); |
303 EXPECT_EQ(1, | 330 EXPECT_EQ(1, |
304 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); | 331 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); |
305 EXPECT_EQ("1000x600", | 332 EXPECT_EQ("1000x600", |
306 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 333 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
307 UpdateDisplay("1000x600*2"); | 334 UpdateDisplay("1000x600*2"); |
308 EXPECT_EQ(2, | 335 EXPECT_EQ(2, |
309 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); | 336 Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); |
310 EXPECT_EQ("500x300", | 337 EXPECT_EQ("500x300", |
311 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); | 338 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); |
312 } | 339 } |
313 | 340 |
314 TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) { | 341 TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChanged) { |
315 const int64 internal_display_id = | 342 const int64 internal_display_id = |
316 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); | 343 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); |
317 const gfx::Display native_display(internal_display_id, | 344 const gfx::Display native_display(internal_display_id, |
318 gfx::Rect(0, 0, 500, 500)); | 345 gfx::Rect(0, 0, 500, 500)); |
319 | 346 |
320 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 347 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
321 std::string default_bounds = | 348 std::string default_bounds = |
322 display_manager()->GetDisplayAt(0)->bounds().ToString(); | 349 display_manager()->GetDisplayAt(0)->bounds().ToString(); |
323 | 350 |
324 std::vector<gfx::Display> displays; | 351 std::vector<gfx::Display> displays; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 FindDisplayForId(10).bounds_in_pixel().ToString()); | 395 FindDisplayForId(10).bounds_in_pixel().ToString()); |
369 | 396 |
370 // External display has disconnected then resumed. | 397 // External display has disconnected then resumed. |
371 displays.push_back(native_display); | 398 displays.push_back(native_display); |
372 display_manager()->OnNativeDisplaysChanged(displays); | 399 display_manager()->OnNativeDisplaysChanged(displays); |
373 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); | 400 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); |
374 EXPECT_EQ("0,0 500x500", | 401 EXPECT_EQ("0,0 500x500", |
375 FindDisplayForId(internal_display_id).bounds().ToString()); | 402 FindDisplayForId(internal_display_id).bounds().ToString()); |
376 } | 403 } |
377 | 404 |
378 TEST_F(DisplayManagerTest, EnsurePointerInDisplays) { | 405 #if defined(OS_CHROMEOS) |
| 406 #define MAYBE_EnsurePointerInDisplays EnsurePointerInDisplays |
| 407 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ |
| 408 EnsurePointerInDisplays_2ndOnLeft |
| 409 #else |
| 410 // TODO(oshima): Re-enable these tests on WinAura (http://crbug.com/158163). |
| 411 #define MAYBE_EnsurePointerInDisplays DISABLED_EnsurePointerInDisplays |
| 412 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ |
| 413 DISABLED_EnsurePointerInDisplays_2ndOnLeft |
| 414 #endif |
| 415 |
| 416 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays) { |
379 UpdateDisplay("200x200,300x300"); | 417 UpdateDisplay("200x200,300x300"); |
380 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 418 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
381 | 419 |
382 aura::Env* env = aura::Env::GetInstance(); | 420 aura::Env* env = aura::Env::GetInstance(); |
383 | 421 |
384 // Set the initial position. | 422 // Set the initial position. |
385 root_windows[0]->MoveCursorTo(gfx::Point(350, 150)); | 423 root_windows[0]->MoveCursorTo(gfx::Point(350, 150)); |
386 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); | 424 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); |
387 | 425 |
388 // A mouse pointer will be inside 2nd display. | 426 // A mouse pointer will be inside 2nd display. |
(...skipping 17 matching lines...) Expand all Loading... |
406 | 444 |
407 // Move the mouse pointer to the bottom of 1st display. | 445 // Move the mouse pointer to the bottom of 1st display. |
408 root_windows[0]->MoveCursorTo(gfx::Point(150, 290)); | 446 root_windows[0]->MoveCursorTo(gfx::Point(150, 290)); |
409 EXPECT_EQ("150,290", env->last_mouse_location().ToString()); | 447 EXPECT_EQ("150,290", env->last_mouse_location().ToString()); |
410 | 448 |
411 // The mouse pointer is outside and closest display is 1st one. | 449 // The mouse pointer is outside and closest display is 1st one. |
412 UpdateDisplay("300x280,200x200"); | 450 UpdateDisplay("300x280,200x200"); |
413 EXPECT_EQ("150,140", env->last_mouse_location().ToString()); | 451 EXPECT_EQ("150,140", env->last_mouse_location().ToString()); |
414 } | 452 } |
415 | 453 |
416 TEST_F(DisplayManagerTest, EnsurePointerInDisplays_2ndOnLeft) { | 454 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) { |
417 UpdateDisplay("200x200,300x300"); | 455 UpdateDisplay("200x200,300x300"); |
418 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 456 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
419 | 457 |
420 // Set the 2nd display on the left. | 458 // Set the 2nd display on the left. |
421 DisplayController* display_controller = | 459 DisplayController* display_controller = |
422 Shell::GetInstance()->display_controller(); | 460 Shell::GetInstance()->display_controller(); |
423 DisplayLayout layout = display_controller->default_display_layout(); | 461 DisplayLayout layout = display_controller->default_display_layout(); |
424 layout.position = DisplayLayout::LEFT; | 462 layout.position = DisplayLayout::LEFT; |
425 display_controller->SetDefaultDisplayLayout(layout); | 463 display_controller->SetDefaultDisplayLayout(layout); |
426 | 464 |
(...skipping 14 matching lines...) Expand all Loading... |
441 // center of 2nd display. | 479 // center of 2nd display. |
442 UpdateDisplay("300x300,200x100"); | 480 UpdateDisplay("300x300,200x100"); |
443 EXPECT_EQ("-100,50", env->last_mouse_location().ToString()); | 481 EXPECT_EQ("-100,50", env->last_mouse_location().ToString()); |
444 | 482 |
445 // 2nd display was disconnected. Mouse pointer should move to | 483 // 2nd display was disconnected. Mouse pointer should move to |
446 // 1st display. | 484 // 1st display. |
447 UpdateDisplay("300x300"); | 485 UpdateDisplay("300x300"); |
448 EXPECT_EQ("150,150", env->last_mouse_location().ToString()); | 486 EXPECT_EQ("150,150", env->last_mouse_location().ToString()); |
449 } | 487 } |
450 | 488 |
451 TEST_F(DisplayManagerTest, NativeDisplaysChangedAfterPrimaryChange) { | 489 TEST_F(DisplayManagerTest, MAYBE_NativeDisplaysChangedAfterPrimaryChange) { |
452 const int64 internal_display_id = | 490 const int64 internal_display_id = |
453 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); | 491 display_manager()->SetFirstDisplayAsInternalDisplayForTest(); |
454 const gfx::Display native_display(internal_display_id, | 492 const gfx::Display native_display(internal_display_id, |
455 gfx::Rect(0, 0, 500, 500)); | 493 gfx::Rect(0, 0, 500, 500)); |
456 const gfx::Display secondary_display(10, gfx::Rect(1, 1, 100, 100)); | 494 const gfx::Display secondary_display(10, gfx::Rect(1, 1, 100, 100)); |
457 | 495 |
458 std::vector<gfx::Display> displays; | 496 std::vector<gfx::Display> displays; |
459 displays.push_back(native_display); | 497 displays.push_back(native_display); |
460 displays.push_back(secondary_display); | 498 displays.push_back(secondary_display); |
461 display_manager()->OnNativeDisplaysChanged(displays); | 499 display_manager()->OnNativeDisplaysChanged(displays); |
(...skipping 11 matching lines...) Expand all Loading... |
473 // OnNativeDisplaysChanged may change the display bounds. Here makes sure | 511 // OnNativeDisplaysChanged may change the display bounds. Here makes sure |
474 // nothing changed if the exactly same displays are specified. | 512 // nothing changed if the exactly same displays are specified. |
475 display_manager()->OnNativeDisplaysChanged(displays); | 513 display_manager()->OnNativeDisplaysChanged(displays); |
476 EXPECT_EQ("-500,0 500x500", | 514 EXPECT_EQ("-500,0 500x500", |
477 FindDisplayForId(internal_display_id).bounds().ToString()); | 515 FindDisplayForId(internal_display_id).bounds().ToString()); |
478 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); | 516 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); |
479 } | 517 } |
480 | 518 |
481 } // namespace internal | 519 } // namespace internal |
482 } // namespace ash | 520 } // namespace ash |
OLD | NEW |