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

Side by Side Diff: ui/display/chromeos/display_configurator_unittest.cc

Issue 284853002: Fix HDCP in mirror mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittest build Created 6 years, 7 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
« no previous file with comments | « ui/display/chromeos/display_configurator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/display/chromeos/display_configurator.h" 5 #include "ui/display/chromeos/display_configurator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <cstdarg> 10 #include <cstdarg>
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 class TestMirroringController 369 class TestMirroringController
370 : public DisplayConfigurator::SoftwareMirroringController { 370 : public DisplayConfigurator::SoftwareMirroringController {
371 public: 371 public:
372 TestMirroringController() : software_mirroring_enabled_(false) {} 372 TestMirroringController() : software_mirroring_enabled_(false) {}
373 virtual ~TestMirroringController() {} 373 virtual ~TestMirroringController() {}
374 374
375 virtual void SetSoftwareMirroring(bool enabled) OVERRIDE { 375 virtual void SetSoftwareMirroring(bool enabled) OVERRIDE {
376 software_mirroring_enabled_ = enabled; 376 software_mirroring_enabled_ = enabled;
377 } 377 }
378 378
379 bool software_mirroring_enabled() const { 379 virtual bool SoftwareMirroringEnabled() const OVERRIDE {
380 return software_mirroring_enabled_; 380 return software_mirroring_enabled_;
381 } 381 }
382 382
383 private: 383 private:
384 bool software_mirroring_enabled_; 384 bool software_mirroring_enabled_;
385 385
386 DISALLOW_COPY_AND_ASSIGN(TestMirroringController); 386 DISALLOW_COPY_AND_ASSIGN(TestMirroringController);
387 }; 387 };
388 388
389 class DisplayConfiguratorTest : public testing::Test { 389 class DisplayConfiguratorTest : public testing::Test {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 585 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
586 GetCrtcAction(outputs_[1], 586 GetCrtcAction(outputs_[1],
587 &big_mode_, 587 &big_mode_,
588 gfx::Point(0, 588 gfx::Point(0,
589 small_mode_.size().height() + 589 small_mode_.size().height() +
590 DisplayConfigurator::kVerticalGap)) 590 DisplayConfigurator::kVerticalGap))
591 .c_str(), 591 .c_str(),
592 kUngrab, 592 kUngrab,
593 NULL), 593 NULL),
594 log_->GetActionsAndClear()); 594 log_->GetActionsAndClear());
595 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 595 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
596 EXPECT_EQ(1, observer_.num_changes()); 596 EXPECT_EQ(1, observer_.num_changes());
597 597
598 observer_.Reset(); 598 observer_.Reset();
599 EXPECT_TRUE(configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR)); 599 EXPECT_TRUE(configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR));
600 EXPECT_EQ( 600 EXPECT_EQ(
601 JoinActions( 601 JoinActions(
602 kGrab, 602 kGrab,
603 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) 603 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1])
604 .c_str(), 604 .c_str(),
605 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 605 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
606 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), 606 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
607 kUngrab, 607 kUngrab,
608 NULL), 608 NULL),
609 log_->GetActionsAndClear()); 609 log_->GetActionsAndClear());
610 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 610 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
611 EXPECT_EQ(1, observer_.num_changes()); 611 EXPECT_EQ(1, observer_.num_changes());
612 612
613 // Disconnect the second output. 613 // Disconnect the second output.
614 observer_.Reset(); 614 observer_.Reset();
615 UpdateOutputs(1, true); 615 UpdateOutputs(1, true);
616 EXPECT_EQ( 616 EXPECT_EQ(
617 JoinActions( 617 JoinActions(
618 kGrab, 618 kGrab,
619 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), 619 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(),
620 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 620 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
621 kUngrab, 621 kUngrab,
622 NULL), 622 NULL),
623 log_->GetActionsAndClear()); 623 log_->GetActionsAndClear());
624 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 624 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
625 EXPECT_EQ(1, observer_.num_changes()); 625 EXPECT_EQ(1, observer_.num_changes());
626 626
627 // Get rid of shared modes to force software mirroring. 627 // Get rid of shared modes to force software mirroring.
628 outputs_[1].set_modes(std::vector<const DisplayMode*>(1, &big_mode_)); 628 outputs_[1].set_modes(std::vector<const DisplayMode*>(1, &big_mode_));
629 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); 629 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED);
630 UpdateOutputs(2, true); 630 UpdateOutputs(2, true);
631 EXPECT_EQ( 631 EXPECT_EQ(
632 JoinActions( 632 JoinActions(
633 kGrab, 633 kGrab,
634 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 634 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
635 &outputs_[0], 635 &outputs_[0],
636 &outputs_[1]).c_str(), 636 &outputs_[1]).c_str(),
637 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 637 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
638 GetCrtcAction(outputs_[1], 638 GetCrtcAction(outputs_[1],
639 &big_mode_, 639 &big_mode_,
640 gfx::Point(0, 640 gfx::Point(0,
641 small_mode_.size().height() + 641 small_mode_.size().height() +
642 DisplayConfigurator::kVerticalGap)) 642 DisplayConfigurator::kVerticalGap))
643 .c_str(), 643 .c_str(),
644 kUngrab, 644 kUngrab,
645 NULL), 645 NULL),
646 log_->GetActionsAndClear()); 646 log_->GetActionsAndClear());
647 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 647 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
648 648
649 observer_.Reset(); 649 observer_.Reset();
650 EXPECT_TRUE(configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR)); 650 EXPECT_TRUE(configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR));
651 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), log_->GetActionsAndClear()); 651 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), log_->GetActionsAndClear());
652 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 652 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
653 configurator_.display_state()); 653 configurator_.display_state());
654 EXPECT_TRUE(mirroring_controller_.software_mirroring_enabled()); 654 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled());
655 EXPECT_EQ(1, observer_.num_changes()); 655 EXPECT_EQ(1, observer_.num_changes());
656 656
657 // Setting MULTIPLE_DISPLAY_STATE_DUAL_MIRROR should try to reconfigure. 657 // Setting MULTIPLE_DISPLAY_STATE_DUAL_MIRROR should try to reconfigure.
658 observer_.Reset(); 658 observer_.Reset();
659 EXPECT_TRUE( 659 EXPECT_TRUE(
660 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED)); 660 configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED));
661 EXPECT_EQ(JoinActions(NULL), log_->GetActionsAndClear()); 661 EXPECT_EQ(JoinActions(NULL), log_->GetActionsAndClear());
662 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 662 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
663 EXPECT_EQ(1, observer_.num_changes()); 663 EXPECT_EQ(1, observer_.num_changes());
664 664
665 // Set back to software mirror mode. 665 // Set back to software mirror mode.
666 observer_.Reset(); 666 observer_.Reset();
667 EXPECT_TRUE(configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR)); 667 EXPECT_TRUE(configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR));
668 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), log_->GetActionsAndClear()); 668 EXPECT_EQ(JoinActions(kGrab, kUngrab, NULL), log_->GetActionsAndClear());
669 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 669 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
670 configurator_.display_state()); 670 configurator_.display_state());
671 EXPECT_TRUE(mirroring_controller_.software_mirroring_enabled()); 671 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled());
672 EXPECT_EQ(1, observer_.num_changes()); 672 EXPECT_EQ(1, observer_.num_changes());
673 673
674 // Disconnect the second output. 674 // Disconnect the second output.
675 observer_.Reset(); 675 observer_.Reset();
676 UpdateOutputs(1, true); 676 UpdateOutputs(1, true);
677 EXPECT_EQ( 677 EXPECT_EQ(
678 JoinActions( 678 JoinActions(
679 kGrab, 679 kGrab,
680 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(), 680 GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(),
681 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 681 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
682 kUngrab, 682 kUngrab,
683 NULL), 683 NULL),
684 log_->GetActionsAndClear()); 684 log_->GetActionsAndClear());
685 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 685 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
686 EXPECT_EQ(1, observer_.num_changes()); 686 EXPECT_EQ(1, observer_.num_changes());
687 } 687 }
688 688
689 TEST_F(DisplayConfiguratorTest, SetDisplayPower) { 689 TEST_F(DisplayConfiguratorTest, SetDisplayPower) {
690 InitWithSingleOutput(); 690 InitWithSingleOutput();
691 691
692 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); 692 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
693 observer_.Reset(); 693 observer_.Reset();
694 UpdateOutputs(2, true); 694 UpdateOutputs(2, true);
695 EXPECT_EQ( 695 EXPECT_EQ(
696 JoinActions( 696 JoinActions(
697 kGrab, 697 kGrab,
698 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) 698 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1])
699 .c_str(), 699 .c_str(),
700 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 700 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
701 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), 701 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
702 kUngrab, 702 kUngrab,
703 NULL), 703 NULL),
704 log_->GetActionsAndClear()); 704 log_->GetActionsAndClear());
705 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 705 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
706 EXPECT_EQ(1, observer_.num_changes()); 706 EXPECT_EQ(1, observer_.num_changes());
707 707
708 // Turning off the internal display should switch the external display to 708 // Turning off the internal display should switch the external display to
709 // its native mode. 709 // its native mode.
710 observer_.Reset(); 710 observer_.Reset();
711 configurator_.SetDisplayPower( 711 configurator_.SetDisplayPower(
712 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, 712 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
713 DisplayConfigurator::kSetDisplayPowerNoFlags); 713 DisplayConfigurator::kSetDisplayPowerNoFlags);
714 EXPECT_EQ( 714 EXPECT_EQ(
715 JoinActions( 715 JoinActions(
(...skipping 17 matching lines...) Expand all
733 EXPECT_EQ( 733 EXPECT_EQ(
734 JoinActions(kGrab, 734 JoinActions(kGrab,
735 GetFramebufferAction( 735 GetFramebufferAction(
736 small_mode_.size(), &outputs_[0], &outputs_[1]).c_str(), 736 small_mode_.size(), &outputs_[0], &outputs_[1]).c_str(),
737 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), 737 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(),
738 GetCrtcAction(outputs_[1], NULL, gfx::Point(0, 0)).c_str(), 738 GetCrtcAction(outputs_[1], NULL, gfx::Point(0, 0)).c_str(),
739 kUngrab, 739 kUngrab,
740 NULL), 740 NULL),
741 log_->GetActionsAndClear()); 741 log_->GetActionsAndClear());
742 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state()); 742 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state());
743 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 743 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
744 EXPECT_EQ(1, observer_.num_changes()); 744 EXPECT_EQ(1, observer_.num_changes());
745 745
746 // Turn all displays on and check that mirroring is still used. 746 // Turn all displays on and check that mirroring is still used.
747 observer_.Reset(); 747 observer_.Reset();
748 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON, 748 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
749 DisplayConfigurator::kSetDisplayPowerNoFlags); 749 DisplayConfigurator::kSetDisplayPowerNoFlags);
750 EXPECT_EQ( 750 EXPECT_EQ(
751 JoinActions( 751 JoinActions(
752 kGrab, 752 kGrab,
753 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1]) 753 GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1])
754 .c_str(), 754 .c_str(),
755 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 755 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
756 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(), 756 GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
757 kForceDPMS, 757 kForceDPMS,
758 kUngrab, 758 kUngrab,
759 NULL), 759 NULL),
760 log_->GetActionsAndClear()); 760 log_->GetActionsAndClear());
761 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state()); 761 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, configurator_.display_state());
762 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 762 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
763 EXPECT_EQ(1, observer_.num_changes()); 763 EXPECT_EQ(1, observer_.num_changes());
764 764
765 // Get rid of shared modes to force software mirroring. 765 // Get rid of shared modes to force software mirroring.
766 outputs_[1].set_modes(std::vector<const DisplayMode*>(1, &big_mode_)); 766 outputs_[1].set_modes(std::vector<const DisplayMode*>(1, &big_mode_));
767 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR); 767 state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
768 observer_.Reset(); 768 observer_.Reset();
769 UpdateOutputs(2, true); 769 UpdateOutputs(2, true);
770 const int kDualHeight = small_mode_.size().height() + 770 const int kDualHeight = small_mode_.size().height() +
771 DisplayConfigurator::kVerticalGap + 771 DisplayConfigurator::kVerticalGap +
772 big_mode_.size().height(); 772 big_mode_.size().height();
773 EXPECT_EQ( 773 EXPECT_EQ(
774 JoinActions( 774 JoinActions(
775 kGrab, 775 kGrab,
776 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 776 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
777 &outputs_[0], 777 &outputs_[0],
778 &outputs_[1]).c_str(), 778 &outputs_[1]).c_str(),
779 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 779 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
780 GetCrtcAction(outputs_[1], 780 GetCrtcAction(outputs_[1],
781 &big_mode_, 781 &big_mode_,
782 gfx::Point(0, 782 gfx::Point(0,
783 small_mode_.size().height() + 783 small_mode_.size().height() +
784 DisplayConfigurator::kVerticalGap)) 784 DisplayConfigurator::kVerticalGap))
785 .c_str(), 785 .c_str(),
786 kUngrab, 786 kUngrab,
787 NULL), 787 NULL),
788 log_->GetActionsAndClear()); 788 log_->GetActionsAndClear());
789 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 789 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
790 configurator_.display_state()); 790 configurator_.display_state());
791 EXPECT_TRUE(mirroring_controller_.software_mirroring_enabled()); 791 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled());
792 EXPECT_EQ(1, observer_.num_changes()); 792 EXPECT_EQ(1, observer_.num_changes());
793 793
794 // Turning off the internal display should switch the external display to 794 // Turning off the internal display should switch the external display to
795 // its native mode. 795 // its native mode.
796 observer_.Reset(); 796 observer_.Reset();
797 configurator_.SetDisplayPower( 797 configurator_.SetDisplayPower(
798 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON, 798 chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
799 DisplayConfigurator::kSetDisplayPowerNoFlags); 799 DisplayConfigurator::kSetDisplayPowerNoFlags);
800 EXPECT_EQ( 800 EXPECT_EQ(
801 JoinActions( 801 JoinActions(
802 kGrab, 802 kGrab,
803 GetFramebufferAction(big_mode_.size(), &outputs_[0], &outputs_[1]) 803 GetFramebufferAction(big_mode_.size(), &outputs_[0], &outputs_[1])
804 .c_str(), 804 .c_str(),
805 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), 805 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(),
806 GetCrtcAction(outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(), 806 GetCrtcAction(outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(),
807 kForceDPMS, 807 kForceDPMS,
808 kUngrab, 808 kUngrab,
809 NULL), 809 NULL),
810 log_->GetActionsAndClear()); 810 log_->GetActionsAndClear());
811 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, configurator_.display_state()); 811 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_SINGLE, configurator_.display_state());
812 EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled()); 812 EXPECT_FALSE(mirroring_controller_.SoftwareMirroringEnabled());
813 EXPECT_EQ(1, observer_.num_changes()); 813 EXPECT_EQ(1, observer_.num_changes());
814 814
815 // When all displays are turned off, the framebuffer should switch back 815 // When all displays are turned off, the framebuffer should switch back
816 // to the extended + software mirroring. 816 // to the extended + software mirroring.
817 observer_.Reset(); 817 observer_.Reset();
818 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF, 818 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_OFF,
819 DisplayConfigurator::kSetDisplayPowerNoFlags); 819 DisplayConfigurator::kSetDisplayPowerNoFlags);
820 EXPECT_EQ( 820 EXPECT_EQ(
821 JoinActions( 821 JoinActions(
822 kGrab, 822 kGrab,
823 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 823 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
824 &outputs_[0], 824 &outputs_[0],
825 &outputs_[1]).c_str(), 825 &outputs_[1]).c_str(),
826 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(), 826 GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(),
827 GetCrtcAction(outputs_[1], 827 GetCrtcAction(outputs_[1],
828 NULL, 828 NULL,
829 gfx::Point(0, 829 gfx::Point(0,
830 small_mode_.size().height() + 830 small_mode_.size().height() +
831 DisplayConfigurator::kVerticalGap)) 831 DisplayConfigurator::kVerticalGap))
832 .c_str(), 832 .c_str(),
833 kUngrab, 833 kUngrab,
834 NULL), 834 NULL),
835 log_->GetActionsAndClear()); 835 log_->GetActionsAndClear());
836 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 836 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
837 configurator_.display_state()); 837 configurator_.display_state());
838 EXPECT_TRUE(mirroring_controller_.software_mirroring_enabled()); 838 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled());
839 EXPECT_EQ(1, observer_.num_changes()); 839 EXPECT_EQ(1, observer_.num_changes());
840 840
841 // Turn all displays on and check that mirroring is still used. 841 // Turn all displays on and check that mirroring is still used.
842 observer_.Reset(); 842 observer_.Reset();
843 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON, 843 configurator_.SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON,
844 DisplayConfigurator::kSetDisplayPowerNoFlags); 844 DisplayConfigurator::kSetDisplayPowerNoFlags);
845 EXPECT_EQ( 845 EXPECT_EQ(
846 JoinActions( 846 JoinActions(
847 kGrab, 847 kGrab,
848 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight), 848 GetFramebufferAction(gfx::Size(big_mode_.size().width(), kDualHeight),
849 &outputs_[0], 849 &outputs_[0],
850 &outputs_[1]).c_str(), 850 &outputs_[1]).c_str(),
851 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(), 851 GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
852 GetCrtcAction(outputs_[1], 852 GetCrtcAction(outputs_[1],
853 &big_mode_, 853 &big_mode_,
854 gfx::Point(0, 854 gfx::Point(0,
855 small_mode_.size().height() + 855 small_mode_.size().height() +
856 DisplayConfigurator::kVerticalGap)) 856 DisplayConfigurator::kVerticalGap))
857 .c_str(), 857 .c_str(),
858 kForceDPMS, 858 kForceDPMS,
859 kUngrab, 859 kUngrab,
860 NULL), 860 NULL),
861 log_->GetActionsAndClear()); 861 log_->GetActionsAndClear());
862 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, 862 EXPECT_EQ(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED,
863 configurator_.display_state()); 863 configurator_.display_state());
864 EXPECT_TRUE(mirroring_controller_.software_mirroring_enabled()); 864 EXPECT_TRUE(mirroring_controller_.SoftwareMirroringEnabled());
865 EXPECT_EQ(1, observer_.num_changes()); 865 EXPECT_EQ(1, observer_.num_changes());
866 } 866 }
867 867
868 TEST_F(DisplayConfiguratorTest, SuspendAndResume) { 868 TEST_F(DisplayConfiguratorTest, SuspendAndResume) {
869 InitWithSingleOutput(); 869 InitWithSingleOutput();
870 870
871 // No preparation is needed before suspending when the display is already 871 // No preparation is needed before suspending when the display is already
872 // on. The configurator should still reprobe on resume in case a display 872 // on. The configurator should still reprobe on resume in case a display
873 // was connected while suspended. 873 // was connected while suspended.
874 configurator_.SuspendDisplays(); 874 configurator_.SuspendDisplays();
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 gfx::Point(0, 1359 gfx::Point(0,
1360 modes[0]->size().height() + 1360 modes[0]->size().height() +
1361 DisplayConfigurator::kVerticalGap)) 1361 DisplayConfigurator::kVerticalGap))
1362 .c_str(), 1362 .c_str(),
1363 kUngrab, 1363 kUngrab,
1364 NULL), 1364 NULL),
1365 log_->GetActionsAndClear()); 1365 log_->GetActionsAndClear());
1366 } 1366 }
1367 1367
1368 } // namespace ui 1368 } // namespace ui
OLDNEW
« no previous file with comments | « ui/display/chromeos/display_configurator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698