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

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

Issue 16539005: Skip mulitple-dispay tests on win8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again, and comment Created 7 years, 6 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 | 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/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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 private: 112 private:
113 vector<gfx::Display> changed_; 113 vector<gfx::Display> changed_;
114 vector<gfx::Display> added_; 114 vector<gfx::Display> added_;
115 size_t removed_count_; 115 size_t removed_count_;
116 bool root_window_destroyed_; 116 bool root_window_destroyed_;
117 117
118 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest); 118 DISALLOW_COPY_AND_ASSIGN(DisplayManagerTest);
119 }; 119 };
120 120
121 TEST_F(DisplayManagerTest, NativeDisplayTest) { 121 TEST_F(DisplayManagerTest, NativeDisplayTest) {
122 RETURN_IF_WIN8;
123
122 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 124 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
123 125
124 // Update primary and add seconary. 126 // Update primary and add seconary.
125 UpdateDisplay("100+0-500x500,0+501-400x400"); 127 UpdateDisplay("100+0-500x500,0+501-400x400");
126 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 128 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
127 EXPECT_EQ("0,0 500x500", 129 EXPECT_EQ("0,0 500x500",
128 display_manager()->GetDisplayAt(0)->bounds().ToString()); 130 display_manager()->GetDisplayAt(0)->bounds().ToString());
129 131
130 EXPECT_EQ("1 1 0", GetCountSummary()); 132 EXPECT_EQ("1 1 0", GetCountSummary());
131 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id()); 133 EXPECT_EQ(display_manager()->GetDisplayAt(0)->id(), changed()[0].id());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // Secondary display is on right. 205 // Secondary display is on right.
204 EXPECT_EQ("1000,0 600x400", 206 EXPECT_EQ("1000,0 600x400",
205 display_manager()->GetDisplayAt(1)->bounds().ToString()); 207 display_manager()->GetDisplayAt(1)->bounds().ToString());
206 EXPECT_EQ("1000,1000 600x400", 208 EXPECT_EQ("1000,1000 600x400",
207 GetDisplayInfoAt(1).bounds_in_pixel().ToString()); 209 GetDisplayInfoAt(1).bounds_in_pixel().ToString());
208 reset(); 210 reset();
209 } 211 }
210 212
211 // Test in emulation mode (use_fullscreen_host_window=false) 213 // Test in emulation mode (use_fullscreen_host_window=false)
212 TEST_F(DisplayManagerTest, EmulatorTest) { 214 TEST_F(DisplayManagerTest, EmulatorTest) {
215 RETURN_IF_WIN8;
216
213 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 217 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
214 218
215 display_manager()->AddRemoveDisplay(); 219 display_manager()->AddRemoveDisplay();
216 // Update primary and add seconary. 220 // Update primary and add seconary.
217 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 221 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
218 EXPECT_EQ("0 1 0", GetCountSummary()); 222 EXPECT_EQ("0 1 0", GetCountSummary());
219 reset(); 223 reset();
220 224
221 display_manager()->AddRemoveDisplay(); 225 display_manager()->AddRemoveDisplay();
222 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 226 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
223 EXPECT_EQ("0 0 1", GetCountSummary()); 227 EXPECT_EQ("0 0 1", GetCountSummary());
224 reset(); 228 reset();
225 229
226 display_manager()->AddRemoveDisplay(); 230 display_manager()->AddRemoveDisplay();
227 EXPECT_EQ(2U, display_manager()->GetNumDisplays()); 231 EXPECT_EQ(2U, display_manager()->GetNumDisplays());
228 EXPECT_EQ("0 1 0", GetCountSummary()); 232 EXPECT_EQ("0 1 0", GetCountSummary());
229 reset(); 233 reset();
230 } 234 }
231 235
232 TEST_F(DisplayManagerTest, OverscanInsetsTest) { 236 TEST_F(DisplayManagerTest, OverscanInsetsTest) {
237 RETURN_IF_WIN8;
238
233 UpdateDisplay("0+0-500x500,0+501-400x400"); 239 UpdateDisplay("0+0-500x500,0+501-400x400");
234 reset(); 240 reset();
235 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); 241 ASSERT_EQ(2u, display_manager()->GetNumDisplays());
236 const DisplayInfo& display_info1 = GetDisplayInfoAt(0); 242 const DisplayInfo& display_info1 = GetDisplayInfoAt(0);
237 const DisplayInfo& display_info2 = GetDisplayInfoAt(1); 243 const DisplayInfo& display_info2 = GetDisplayInfoAt(1);
238 display_manager()->SetOverscanInsets( 244 display_manager()->SetOverscanInsets(
239 display_info2.id(), gfx::Insets(13, 12, 11, 10)); 245 display_info2.id(), gfx::Insets(13, 12, 11, 10));
240 246
241 std::vector<gfx::Display> changed_displays = changed(); 247 std::vector<gfx::Display> changed_displays = changed();
242 EXPECT_EQ(1u, changed_displays.size()); 248 EXPECT_EQ(1u, changed_displays.size());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 GetDisplayInfo(ScreenAsh::GetSecondaryDisplay()). 331 GetDisplayInfo(ScreenAsh::GetSecondaryDisplay()).
326 bounds_in_pixel().ToString()); 332 bounds_in_pixel().ToString());
327 EXPECT_EQ("0,501 400x400", 333 EXPECT_EQ("0,501 400x400",
328 GetDisplayInfo(Shell::GetScreen()->GetPrimaryDisplay()). 334 GetDisplayInfo(Shell::GetScreen()->GetPrimaryDisplay()).
329 bounds_in_pixel().ToString()); 335 bounds_in_pixel().ToString());
330 EXPECT_EQ("0,0 188x190", 336 EXPECT_EQ("0,0 188x190",
331 Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); 337 Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString());
332 } 338 }
333 339
334 TEST_F(DisplayManagerTest, ZeroOverscanInsets) { 340 TEST_F(DisplayManagerTest, ZeroOverscanInsets) {
341 RETURN_IF_WIN8;
342
335 // Make sure the display change events is emitted for overscan inset changes. 343 // Make sure the display change events is emitted for overscan inset changes.
336 UpdateDisplay("0+0-500x500,0+501-400x400"); 344 UpdateDisplay("0+0-500x500,0+501-400x400");
337 ASSERT_EQ(2u, display_manager()->GetNumDisplays()); 345 ASSERT_EQ(2u, display_manager()->GetNumDisplays());
338 int64 display2_id = display_manager()->GetDisplayAt(1)->id(); 346 int64 display2_id = display_manager()->GetDisplayAt(1)->id();
339 347
340 reset(); 348 reset();
341 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0)); 349 display_manager()->SetOverscanInsets(display2_id, gfx::Insets(0, 0, 0, 0));
342 EXPECT_EQ(0u, changed().size()); 350 EXPECT_EQ(0u, changed().size());
343 351
344 reset(); 352 reset();
(...skipping 19 matching lines...) Expand all
364 EXPECT_EQ("500x300", 372 EXPECT_EQ("500x300",
365 Shell::GetPrimaryRootWindow()->bounds().size().ToString()); 373 Shell::GetPrimaryRootWindow()->bounds().size().ToString());
366 } 374 }
367 375
368 DisplayInfo CreateDisplayInfo(int64 id, const gfx::Rect& bounds) { 376 DisplayInfo CreateDisplayInfo(int64 id, const gfx::Rect& bounds) {
369 DisplayInfo info(id, StringPrintf("x-%d", static_cast<int>(id)), false); 377 DisplayInfo info(id, StringPrintf("x-%d", static_cast<int>(id)), false);
370 info.SetBounds(bounds); 378 info.SetBounds(bounds);
371 return info; 379 return info;
372 } 380 }
373 381
374 #if defined(OS_WIN) 382 TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) {
375 // Crashes flakily on Win8 Aura: http://crbug.com/246109.
376 #define MAYBE_TestNativeDisplaysChanged DISABLED_TestNativeDisplaysChanged
377 #else
378 #define MAYBE_TestNativeDisplaysChanged TestNativeDisplaysChanged
379 #endif
380 TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChanged) {
381 const int internal_display_id = 383 const int internal_display_id =
382 test::DisplayManagerTestApi(display_manager()). 384 test::DisplayManagerTestApi(display_manager()).
383 SetFirstDisplayAsInternalDisplay(); 385 SetFirstDisplayAsInternalDisplay();
384 const int external_id = 10; 386 const int external_id = 10;
385 const int mirror_id = 11; 387 const int mirror_id = 11;
386 const int64 invalid_id = gfx::Display::kInvalidDisplayID; 388 const int64 invalid_id = gfx::Display::kInvalidDisplayID;
387 const DisplayInfo internal_display_info = 389 const DisplayInfo internal_display_info =
388 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 500, 500)); 390 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 500, 500));
389 const DisplayInfo external_display_info = 391 const DisplayInfo external_display_info =
390 CreateDisplayInfo(external_id, gfx::Rect(1, 1, 100, 100)); 392 CreateDisplayInfo(external_id, gfx::Rect(1, 1, 100, 100));
391 const DisplayInfo mirrored_display_info = 393 const DisplayInfo mirrored_display_info =
392 CreateDisplayInfo(mirror_id, gfx::Rect(0, 0, 500, 500)); 394 CreateDisplayInfo(mirror_id, gfx::Rect(0, 0, 500, 500));
393 395
394 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 396 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
395 EXPECT_EQ(1U, display_manager()->num_connected_displays()); 397 EXPECT_EQ(1U, display_manager()->num_connected_displays());
396 std::string default_bounds = 398 std::string default_bounds =
397 display_manager()->GetDisplayAt(0)->bounds().ToString(); 399 display_manager()->GetDisplayAt(0)->bounds().ToString();
398 400
399 std::vector<DisplayInfo> display_info_list; 401 std::vector<DisplayInfo> display_info_list;
400 // Primary disconnected. 402 // Primary disconnected.
401 display_manager()->OnNativeDisplaysChanged(display_info_list); 403 display_manager()->OnNativeDisplaysChanged(display_info_list);
402 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 404 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
403 EXPECT_EQ(default_bounds, 405 EXPECT_EQ(default_bounds,
404 display_manager()->GetDisplayAt(0)->bounds().ToString()); 406 display_manager()->GetDisplayAt(0)->bounds().ToString());
405 EXPECT_EQ(1U, display_manager()->num_connected_displays()); 407 EXPECT_EQ(1U, display_manager()->num_connected_displays());
406 EXPECT_FALSE(display_manager()->mirrored_display().is_valid()); 408 EXPECT_FALSE(display_manager()->mirrored_display().is_valid());
407 409
410 RETURN_IF_WIN8;
411
408 // External connected while primary was disconnected. 412 // External connected while primary was disconnected.
409 display_info_list.push_back(external_display_info); 413 display_info_list.push_back(external_display_info);
410 display_manager()->OnNativeDisplaysChanged(display_info_list); 414 display_manager()->OnNativeDisplaysChanged(display_info_list);
411 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 415 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
412 416
413 EXPECT_EQ(invalid_id, FindDisplayForId(internal_display_id).id()); 417 EXPECT_EQ(invalid_id, FindDisplayForId(internal_display_id).id());
414 EXPECT_EQ("1,1 100x100", 418 EXPECT_EQ("1,1 100x100",
415 FindDisplayInfoForId(external_id).bounds_in_pixel().ToString()); 419 FindDisplayInfoForId(external_id).bounds_in_pixel().ToString());
416 EXPECT_EQ(1U, display_manager()->num_connected_displays()); 420 EXPECT_EQ(1U, display_manager()->num_connected_displays());
417 EXPECT_FALSE(display_manager()->mirrored_display().is_valid()); 421 EXPECT_FALSE(display_manager()->mirrored_display().is_valid());
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 display_manager()->OnNativeDisplaysChanged(display_info_list); 533 display_manager()->OnNativeDisplaysChanged(display_info_list);
530 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 534 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
531 EXPECT_EQ( 535 EXPECT_EQ(
532 "0,0 500x500", 536 "0,0 500x500",
533 FindDisplayInfoForId(internal_display_id).bounds_in_pixel().ToString()); 537 FindDisplayInfoForId(internal_display_id).bounds_in_pixel().ToString());
534 EXPECT_EQ(1U, display_manager()->num_connected_displays()); 538 EXPECT_EQ(1U, display_manager()->num_connected_displays());
535 EXPECT_FALSE(display_manager()->mirrored_display().is_valid()); 539 EXPECT_FALSE(display_manager()->mirrored_display().is_valid());
536 } 540 }
537 541
538 #if defined(OS_WIN) 542 #if defined(OS_WIN)
539 // This test currently fails on Win8/Metro as it picks up the actual 543 // TODO(scottmg): RootWindow doesn't get resized on Windows
540 // display size. http://crbug.com/154081 544 // Ash. http://crbug.com/247916.
541 #define MAYBE_TestNativeDisplaysChangedNoInternal \ 545 #define MAYBE_TestNativeDisplaysChangedNoInternal \
542 DISABLED_TestNativeDisplaysChangedNoInternal 546 DISABLED_TestNativeDisplaysChangedNoInternal
543 #else 547 #else
544 #define MAYBE_TestNativeDisplaysChangedNoInternal \ 548 #define MAYBE_TestNativeDisplaysChangedNoInternal \
545 TestNativeDisplaysChangedNoInternal 549 TestNativeDisplaysChangedNoInternal
546 #endif 550 #endif
547 551
548 TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChangedNoInternal) { 552 TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChangedNoInternal) {
549 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 553 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
550 554
551 // Don't change the display info if all displays are disconnected. 555 // Don't change the display info if all displays are disconnected.
552 std::vector<DisplayInfo> display_info_list; 556 std::vector<DisplayInfo> display_info_list;
553 display_manager()->OnNativeDisplaysChanged(display_info_list); 557 display_manager()->OnNativeDisplaysChanged(display_info_list);
554 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 558 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
555 559
556 // Connect another display which will become primary. 560 // Connect another display which will become primary.
557 const DisplayInfo external_display_info = 561 const DisplayInfo external_display_info =
558 CreateDisplayInfo(10, gfx::Rect(1, 1, 100, 100)); 562 CreateDisplayInfo(10, gfx::Rect(1, 1, 100, 100));
559 display_info_list.push_back(external_display_info); 563 display_info_list.push_back(external_display_info);
560 display_manager()->OnNativeDisplaysChanged(display_info_list); 564 display_manager()->OnNativeDisplaysChanged(display_info_list);
561 EXPECT_EQ(1U, display_manager()->GetNumDisplays()); 565 EXPECT_EQ(1U, display_manager()->GetNumDisplays());
562 EXPECT_EQ("1,1 100x100", 566 EXPECT_EQ("1,1 100x100",
563 FindDisplayInfoForId(10).bounds_in_pixel().ToString()); 567 FindDisplayInfoForId(10).bounds_in_pixel().ToString());
564 EXPECT_EQ("100x100", 568 EXPECT_EQ("100x100",
565 ash::Shell::GetPrimaryRootWindow()->GetHostSize().ToString()); 569 ash::Shell::GetPrimaryRootWindow()->GetHostSize().ToString());
566 } 570 }
567 571
568 TEST_F(DisplayManagerTest, EnsurePointerInDisplays) { 572 TEST_F(DisplayManagerTest, EnsurePointerInDisplays) {
573 RETURN_IF_WIN8;
574
569 UpdateDisplay("200x200,300x300"); 575 UpdateDisplay("200x200,300x300");
570 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 576 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
571 577
572 aura::Env* env = aura::Env::GetInstance(); 578 aura::Env* env = aura::Env::GetInstance();
573 579
574 aura::test::EventGenerator generator(root_windows[0]); 580 aura::test::EventGenerator generator(root_windows[0]);
575 581
576 // Set the initial position. 582 // Set the initial position.
577 generator.MoveMouseToInHost(350, 150); 583 generator.MoveMouseToInHost(350, 150);
578 EXPECT_EQ("350,150", env->last_mouse_location().ToString()); 584 EXPECT_EQ("350,150", env->last_mouse_location().ToString());
(...skipping 19 matching lines...) Expand all
598 604
599 // Move the mouse pointer to the bottom of 1st display. 605 // Move the mouse pointer to the bottom of 1st display.
600 generator.MoveMouseToInHost(150, 290); 606 generator.MoveMouseToInHost(150, 290);
601 EXPECT_EQ("150,290", env->last_mouse_location().ToString()); 607 EXPECT_EQ("150,290", env->last_mouse_location().ToString());
602 608
603 // The mouse pointer is outside and closest display is 1st one. 609 // The mouse pointer is outside and closest display is 1st one.
604 UpdateDisplay("300x280,200x200"); 610 UpdateDisplay("300x280,200x200");
605 EXPECT_EQ("150,140", env->last_mouse_location().ToString()); 611 EXPECT_EQ("150,140", env->last_mouse_location().ToString());
606 } 612 }
607 613
608 #if defined(OS_WIN) 614 TEST_F(DisplayManagerTest, EnsurePointerInDisplays_2ndOnLeft) {
609 // Flaky failures on Win8 due to window activation messages. crbug.com/239539 615 RETURN_IF_WIN8;
610 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \ 616
611 DISABLED_EnsurePointerInDisplays_2ndOnLeft
612 #else
613 #define MAYBE_EnsurePointerInDisplays_2ndOnLeft \
614 EnsurePointerInDisplays_2ndOnLeft
615 #endif
616 TEST_F(DisplayManagerTest, MAYBE_EnsurePointerInDisplays_2ndOnLeft) {
617 // Set the 2nd display on the left. 617 // Set the 2nd display on the left.
618 DisplayController* display_controller = 618 DisplayController* display_controller =
619 Shell::GetInstance()->display_controller(); 619 Shell::GetInstance()->display_controller();
620 DisplayLayout layout = display_controller->default_display_layout(); 620 DisplayLayout layout = display_controller->default_display_layout();
621 layout.position = DisplayLayout::LEFT; 621 layout.position = DisplayLayout::LEFT;
622 display_controller->SetDefaultDisplayLayout(layout); 622 display_controller->SetDefaultDisplayLayout(layout);
623 623
624 UpdateDisplay("200x200,300x300"); 624 UpdateDisplay("200x200,300x300");
625 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 625 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
626 626
(...skipping 15 matching lines...) Expand all
642 UpdateDisplay("300x300,200x100"); 642 UpdateDisplay("300x300,200x100");
643 EXPECT_EQ("-100,50", env->last_mouse_location().ToString()); 643 EXPECT_EQ("-100,50", env->last_mouse_location().ToString());
644 644
645 // 2nd display was disconnected. Mouse pointer should move to 645 // 2nd display was disconnected. Mouse pointer should move to
646 // 1st display. 646 // 1st display.
647 UpdateDisplay("300x300"); 647 UpdateDisplay("300x300");
648 EXPECT_EQ("150,150", env->last_mouse_location().ToString()); 648 EXPECT_EQ("150,150", env->last_mouse_location().ToString());
649 } 649 }
650 650
651 TEST_F(DisplayManagerTest, NativeDisplaysChangedAfterPrimaryChange) { 651 TEST_F(DisplayManagerTest, NativeDisplaysChangedAfterPrimaryChange) {
652 RETURN_IF_WIN8;
653
652 const int64 internal_display_id = 654 const int64 internal_display_id =
653 test::DisplayManagerTestApi(display_manager()). 655 test::DisplayManagerTestApi(display_manager()).
654 SetFirstDisplayAsInternalDisplay(); 656 SetFirstDisplayAsInternalDisplay();
655 const DisplayInfo native_display_info = 657 const DisplayInfo native_display_info =
656 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 500, 500)); 658 CreateDisplayInfo(internal_display_id, gfx::Rect(0, 0, 500, 500));
657 const DisplayInfo secondary_display_info = 659 const DisplayInfo secondary_display_info =
658 CreateDisplayInfo(10, gfx::Rect(1, 1, 100, 100)); 660 CreateDisplayInfo(10, gfx::Rect(1, 1, 100, 100));
659 661
660 std::vector<DisplayInfo> display_info_list; 662 std::vector<DisplayInfo> display_info_list;
661 display_info_list.push_back(native_display_info); 663 display_info_list.push_back(native_display_info);
(...skipping 12 matching lines...) Expand all
674 676
675 // OnNativeDisplaysChanged may change the display bounds. Here makes sure 677 // OnNativeDisplaysChanged may change the display bounds. Here makes sure
676 // nothing changed if the exactly same displays are specified. 678 // nothing changed if the exactly same displays are specified.
677 display_manager()->OnNativeDisplaysChanged(display_info_list); 679 display_manager()->OnNativeDisplaysChanged(display_info_list);
678 EXPECT_EQ("-500,0 500x500", 680 EXPECT_EQ("-500,0 500x500",
679 FindDisplayForId(internal_display_id).bounds().ToString()); 681 FindDisplayForId(internal_display_id).bounds().ToString());
680 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString()); 682 EXPECT_EQ("0,0 100x100", FindDisplayForId(10).bounds().ToString());
681 } 683 }
682 684
683 TEST_F(DisplayManagerTest, AutomaticOverscanInsets) { 685 TEST_F(DisplayManagerTest, AutomaticOverscanInsets) {
686 RETURN_IF_WIN8;
687
684 UpdateDisplay("200x200,400x400"); 688 UpdateDisplay("200x200,400x400");
685 689
686 std::vector<DisplayInfo> display_info_list; 690 std::vector<DisplayInfo> display_info_list;
687 display_info_list.push_back(GetDisplayInfoAt(0)); 691 display_info_list.push_back(GetDisplayInfoAt(0));
688 display_info_list.push_back(GetDisplayInfoAt(1)); 692 display_info_list.push_back(GetDisplayInfoAt(1));
689 display_info_list[1].set_has_overscan_for_test(true); 693 display_info_list[1].set_has_overscan_for_test(true);
690 int64 id = display_info_list[1].id(); 694 int64 id = display_info_list[1].id();
691 // SetDefaultOverscanInsets(&display_info_list[1]); 695 // SetDefaultOverscanInsets(&display_info_list[1]);
692 display_manager()->OnNativeDisplaysChanged(display_info_list); 696 display_manager()->OnNativeDisplaysChanged(display_info_list);
693 // It has overscan insets, although SetOverscanInsets() isn't called. 697 // It has overscan insets, although SetOverscanInsets() isn't called.
(...skipping 13 matching lines...) Expand all
707 EXPECT_EQ("400x400", 711 EXPECT_EQ("400x400",
708 GetDisplayInfoAt(1).size_in_pixel().ToString()); 712 GetDisplayInfoAt(1).size_in_pixel().ToString());
709 713
710 // Clearing the custom overscan should set the bounds to 714 // Clearing the custom overscan should set the bounds to
711 // original. 715 // original.
712 display_manager()->ClearCustomOverscanInsets(id); 716 display_manager()->ClearCustomOverscanInsets(id);
713 EXPECT_EQ("380x380", 717 EXPECT_EQ("380x380",
714 GetDisplayInfoAt(1).size_in_pixel().ToString()); 718 GetDisplayInfoAt(1).size_in_pixel().ToString());
715 } 719 }
716 720
717 #if defined(OS_WIN) 721 TEST_F(DisplayManagerTest, Rotate) {
718 // Flaky on Win8 Aura: http://crbug.com/244466 722 RETURN_IF_WIN8;
719 #define MAYBE_Rotate DISABLED_Rotate 723
720 #else
721 #define MAYBE_Rotate Rotate
722 #endif
723 TEST_F(DisplayManagerTest, MAYBE_Rotate) {
724 UpdateDisplay("100x200/r,300x400/l"); 724 UpdateDisplay("100x200/r,300x400/l");
725 EXPECT_EQ("1,1 100x200", 725 EXPECT_EQ("1,1 100x200",
726 GetDisplayInfoAt(0).bounds_in_pixel().ToString()); 726 GetDisplayInfoAt(0).bounds_in_pixel().ToString());
727 EXPECT_EQ("200x100", 727 EXPECT_EQ("200x100",
728 GetDisplayInfoAt(0).size_in_pixel().ToString()); 728 GetDisplayInfoAt(0).size_in_pixel().ToString());
729 729
730 EXPECT_EQ("1,201 300x400", 730 EXPECT_EQ("1,201 300x400",
731 GetDisplayInfoAt(1).bounds_in_pixel().ToString()); 731 GetDisplayInfoAt(1).bounds_in_pixel().ToString());
732 EXPECT_EQ("400x300", 732 EXPECT_EQ("400x300",
733 GetDisplayInfoAt(1).size_in_pixel().ToString()); 733 GetDisplayInfoAt(1).size_in_pixel().ToString());
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 display_manager()->SetDisplayUIScale(display_id, 0.625f); 818 display_manager()->SetDisplayUIScale(display_id, 0.625f);
819 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).ui_scale()); 819 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).ui_scale());
820 display_manager()->SetDisplayUIScale(display_id, 0.6f); 820 display_manager()->SetDisplayUIScale(display_id, 0.6f);
821 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).ui_scale()); 821 EXPECT_EQ(0.625f, GetDisplayInfoAt(0).ui_scale());
822 display_manager()->SetDisplayUIScale(display_id, 0.5f); 822 display_manager()->SetDisplayUIScale(display_id, 0.5f);
823 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).ui_scale()); 823 EXPECT_EQ(0.5f, GetDisplayInfoAt(0).ui_scale());
824 } 824 }
825 825
826 826
827 #if defined(OS_WIN) 827 #if defined(OS_WIN)
828 // TODO(oshima): On Windows, we don't update the origin/size right away. 828 // TODO(scottmg): RootWindow doesn't get resized on Windows
829 // Ash. http://crbug.com/247916.
829 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo tateZoom 830 #define MAYBE_UpdateMouseCursorAfterRotateZoom DISABLED_UpdateMouseCursorAfterRo tateZoom
830 #else 831 #else
831 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom 832 #define MAYBE_UpdateMouseCursorAfterRotateZoom UpdateMouseCursorAfterRotateZoom
832 #endif 833 #endif
833 834
834 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) { 835 TEST_F(DisplayManagerTest, MAYBE_UpdateMouseCursorAfterRotateZoom) {
835 // Make sure just rotating will not change native location. 836 // Make sure just rotating will not change native location.
836 UpdateDisplay("300x200,200x150"); 837 UpdateDisplay("300x200,200x150");
837 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 838 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
838 aura::Env* env = aura::Env::GetInstance(); 839 aura::Env* env = aura::Env::GetInstance();
(...skipping 23 matching lines...) Expand all
862 EXPECT_EQ("150,225", env->last_mouse_location().ToString()); 863 EXPECT_EQ("150,225", env->last_mouse_location().ToString());
863 864
864 // Test on 2nd display. 865 // Test on 2nd display.
865 UpdateDisplay("600x400,400x300*2"); 866 UpdateDisplay("600x400,400x300*2");
866 generator2.MoveMouseToInHost(200, 100); 867 generator2.MoveMouseToInHost(200, 100);
867 EXPECT_EQ("700,50", env->last_mouse_location().ToString()); 868 EXPECT_EQ("700,50", env->last_mouse_location().ToString());
868 UpdateDisplay("600x400,400x300*2@1.5"); 869 UpdateDisplay("600x400,400x300*2@1.5");
869 EXPECT_EQ("750,75", env->last_mouse_location().ToString()); 870 EXPECT_EQ("750,75", env->last_mouse_location().ToString());
870 } 871 }
871 872
872 #if defined(OS_WIN)
873 // This does not work on metro.
874 #define MAYBE_SoftwareMirroring DISABLED_SoftwareMirroring
875 #else
876 #define MAYBE_SoftwareMirroring SoftwareMirroring
877 #endif
878
879 class TestDisplayObserver : public gfx::DisplayObserver { 873 class TestDisplayObserver : public gfx::DisplayObserver {
880 public: 874 public:
881 TestDisplayObserver() : changed_(false) {} 875 TestDisplayObserver() : changed_(false) {}
882 virtual ~TestDisplayObserver() {} 876 virtual ~TestDisplayObserver() {}
883 877
884 // gfx::DisplayObserver overrides: 878 // gfx::DisplayObserver overrides:
885 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE { 879 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE {
886 } 880 }
887 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE { 881 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE {
888 // Mirror window should already be delete before restoring 882 // Mirror window should already be delete before restoring
(...skipping 14 matching lines...) Expand all
903 return changed; 897 return changed;
904 } 898 }
905 899
906 private: 900 private:
907 test::MirrorWindowTestApi test_api; 901 test::MirrorWindowTestApi test_api;
908 bool changed_; 902 bool changed_;
909 903
910 DISALLOW_COPY_AND_ASSIGN(TestDisplayObserver); 904 DISALLOW_COPY_AND_ASSIGN(TestDisplayObserver);
911 }; 905 };
912 906
913 TEST_F(DisplayManagerTest, MAYBE_SoftwareMirroring) { 907 TEST_F(DisplayManagerTest, SoftwareMirroring) {
908 RETURN_IF_WIN8;
909
914 UpdateDisplay("300x400,400x500"); 910 UpdateDisplay("300x400,400x500");
915 911
916 test::MirrorWindowTestApi test_api; 912 test::MirrorWindowTestApi test_api;
917 EXPECT_EQ(NULL, test_api.GetRootWindow()); 913 EXPECT_EQ(NULL, test_api.GetRootWindow());
918 914
919 TestDisplayObserver display_observer; 915 TestDisplayObserver display_observer;
920 Shell::GetScreen()->AddObserver(&display_observer); 916 Shell::GetScreen()->AddObserver(&display_observer);
921 917
922 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 918 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
923 display_manager->SetSoftwareMirroring(true); 919 display_manager->SetSoftwareMirroring(true);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 UpdateDisplay("400x600/o,600x800/o"); 961 UpdateDisplay("400x600/o,600x800/o");
966 EXPECT_FALSE(display_observer.changed_and_reset()); 962 EXPECT_FALSE(display_observer.changed_and_reset());
967 EXPECT_EQ("400x600", test_api.GetRootWindow()->bounds().size().ToString()); 963 EXPECT_EQ("400x600", test_api.GetRootWindow()->bounds().size().ToString());
968 EXPECT_EQ("600x800", GetMirroredDisplay().size().ToString()); 964 EXPECT_EQ("600x800", GetMirroredDisplay().size().ToString());
969 965
970 Shell::GetScreen()->RemoveObserver(&display_observer); 966 Shell::GetScreen()->RemoveObserver(&display_observer);
971 } 967 }
972 968
973 } // namespace internal 969 } // namespace internal
974 } // namespace ash 970 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698