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 "chromeos/display/output_configurator.h" | 5 #include "chromeos/display/output_configurator.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstdarg> | 8 #include <cstdarg> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 GetCrtcAction(outputs_[1].crtc, 0, | 780 GetCrtcAction(outputs_[1].crtc, 0, |
781 kSmallModeHeight + OutputConfigurator::kVerticalGap, | 781 kSmallModeHeight + OutputConfigurator::kVerticalGap, |
782 kBigModeId, outputs_[1].output).c_str(), | 782 kBigModeId, outputs_[1].output).c_str(), |
783 kForceDPMS, kUngrab, NULL), | 783 kForceDPMS, kUngrab, NULL), |
784 delegate_->GetActionsAndClear()); | 784 delegate_->GetActionsAndClear()); |
785 EXPECT_EQ(STATE_DUAL_EXTENDED, configurator_.output_state()); | 785 EXPECT_EQ(STATE_DUAL_EXTENDED, configurator_.output_state()); |
786 EXPECT_TRUE(mirroring_controller_.software_mirroring_enabled()); | 786 EXPECT_TRUE(mirroring_controller_.software_mirroring_enabled()); |
787 EXPECT_EQ(1, observer_.num_changes()); | 787 EXPECT_EQ(1, observer_.num_changes()); |
788 } | 788 } |
789 | 789 |
790 TEST_F(OutputConfiguratorTest, Casting) { | |
791 InitWithSingleOutput(); | |
792 | |
793 // Notify configurator that casting session is started. | |
794 configurator_.OnCastingStateChanged(true); | |
795 EXPECT_EQ(JoinActions(kProjectingOn, NULL), delegate_->GetActionsAndClear()); | |
Daniel Erat
2014/01/17 19:13:51
nit: after this code, maybe add:
configurator_.
hshi1
2014/01/17 19:31:28
Done.
| |
796 | |
797 // Turn all displays off and check that projecting is not turned off. | |
798 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_OFF, | |
799 OutputConfigurator::kSetDisplayPowerNoFlags); | |
800 EXPECT_EQ(JoinActions(kGrab, | |
801 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight, | |
802 outputs_[0].crtc, 0).c_str(), | |
803 GetCrtcAction(outputs_[0].crtc, 0, 0, 0, | |
804 outputs_[0].output).c_str(), | |
805 kUngrab, NULL), | |
806 delegate_->GetActionsAndClear()); | |
807 | |
808 // Turn all displays back on. | |
809 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_ON, | |
810 OutputConfigurator::kSetDisplayPowerNoFlags); | |
811 EXPECT_EQ(JoinActions(kGrab, | |
812 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight, | |
813 outputs_[0].crtc, 0).c_str(), | |
814 GetCrtcAction(outputs_[0].crtc, 0, 0, kSmallModeId, | |
815 outputs_[0].output).c_str(), | |
816 kForceDPMS, kUngrab, NULL), | |
817 delegate_->GetActionsAndClear()); | |
818 | |
819 // Notify configurator that casting session is ended. | |
820 configurator_.OnCastingStateChanged(false); | |
821 EXPECT_EQ(JoinActions(kProjectingOff, NULL), delegate_->GetActionsAndClear()); | |
822 } | |
823 | |
790 TEST_F(OutputConfiguratorTest, SuspendAndResume) { | 824 TEST_F(OutputConfiguratorTest, SuspendAndResume) { |
791 InitWithSingleOutput(); | 825 InitWithSingleOutput(); |
792 | 826 |
793 // No preparation is needed before suspending when the display is already | 827 // No preparation is needed before suspending when the display is already |
794 // on. The configurator should still reprobe on resume in case a display | 828 // on. The configurator should still reprobe on resume in case a display |
795 // was connected while suspended. | 829 // was connected while suspended. |
796 configurator_.SuspendDisplays(); | 830 configurator_.SuspendDisplays(); |
797 EXPECT_EQ(kNoActions, delegate_->GetActionsAndClear()); | 831 EXPECT_EQ(kNoActions, delegate_->GetActionsAndClear()); |
798 configurator_.ResumeDisplays(); | 832 configurator_.ResumeDisplays(); |
799 EXPECT_EQ(JoinActions(kGrab, | 833 EXPECT_EQ(JoinActions(kGrab, |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1398 GetCrtcAction(outputs_[1].crtc, 0, | 1432 GetCrtcAction(outputs_[1].crtc, 0, |
1399 outputs_[1].mode_infos[kFirstMode].height + | 1433 outputs_[1].mode_infos[kFirstMode].height + |
1400 OutputConfigurator::kVerticalGap, kFirstMode + 3, | 1434 OutputConfigurator::kVerticalGap, kFirstMode + 3, |
1401 outputs_[1].output).c_str(), | 1435 outputs_[1].output).c_str(), |
1402 kUngrab, kProjectingOn, NULL), | 1436 kUngrab, kProjectingOn, NULL), |
1403 delegate_->GetActionsAndClear()); | 1437 delegate_->GetActionsAndClear()); |
1404 | 1438 |
1405 } | 1439 } |
1406 | 1440 |
1407 } // namespace chromeos | 1441 } // namespace chromeos |
OLD | NEW |