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_.OnCastingSessionStartedOrStopped(true); | |
795 EXPECT_EQ(JoinActions(kProjectingOn, NULL), delegate_->GetActionsAndClear()); | |
Daniel Erat
2014/01/17 20:21:15
nit: you should be able to just do:
EXPECT_EQ(k
hshi1
2014/01/17 20:52:53
Done, thanks!
| |
796 | |
797 // Verify that the configurator keeps a count of active casting sessions | |
798 // instead of treating it as a single global state. | |
799 configurator_.OnCastingSessionStartedOrStopped(true); | |
800 EXPECT_EQ(JoinActions(kProjectingOn, NULL), delegate_->GetActionsAndClear()); | |
801 configurator_.OnCastingSessionStartedOrStopped(false); | |
802 EXPECT_EQ(JoinActions(kProjectingOn, NULL), delegate_->GetActionsAndClear()); | |
803 | |
804 // Turn all displays off and check that projecting is not turned off. | |
805 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_OFF, | |
806 OutputConfigurator::kSetDisplayPowerNoFlags); | |
807 EXPECT_EQ(JoinActions(kGrab, | |
808 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight, | |
809 outputs_[0].crtc, 0).c_str(), | |
810 GetCrtcAction(outputs_[0].crtc, 0, 0, 0, | |
811 outputs_[0].output).c_str(), | |
812 kUngrab, NULL), | |
813 delegate_->GetActionsAndClear()); | |
814 | |
815 // Turn all displays back on. | |
816 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_ON, | |
817 OutputConfigurator::kSetDisplayPowerNoFlags); | |
818 EXPECT_EQ(JoinActions(kGrab, | |
819 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight, | |
820 outputs_[0].crtc, 0).c_str(), | |
821 GetCrtcAction(outputs_[0].crtc, 0, 0, kSmallModeId, | |
822 outputs_[0].output).c_str(), | |
823 kForceDPMS, kUngrab, NULL), | |
824 delegate_->GetActionsAndClear()); | |
825 | |
826 // Notify configurator that casting session is ended. | |
827 configurator_.OnCastingSessionStartedOrStopped(false); | |
828 EXPECT_EQ(JoinActions(kProjectingOff, NULL), delegate_->GetActionsAndClear()); | |
829 } | |
830 | |
790 TEST_F(OutputConfiguratorTest, SuspendAndResume) { | 831 TEST_F(OutputConfiguratorTest, SuspendAndResume) { |
791 InitWithSingleOutput(); | 832 InitWithSingleOutput(); |
792 | 833 |
793 // No preparation is needed before suspending when the display is already | 834 // No preparation is needed before suspending when the display is already |
794 // on. The configurator should still reprobe on resume in case a display | 835 // on. The configurator should still reprobe on resume in case a display |
795 // was connected while suspended. | 836 // was connected while suspended. |
796 configurator_.SuspendDisplays(); | 837 configurator_.SuspendDisplays(); |
797 EXPECT_EQ(kNoActions, delegate_->GetActionsAndClear()); | 838 EXPECT_EQ(kNoActions, delegate_->GetActionsAndClear()); |
798 configurator_.ResumeDisplays(); | 839 configurator_.ResumeDisplays(); |
799 EXPECT_EQ(JoinActions(kGrab, | 840 EXPECT_EQ(JoinActions(kGrab, |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1398 GetCrtcAction(outputs_[1].crtc, 0, | 1439 GetCrtcAction(outputs_[1].crtc, 0, |
1399 outputs_[1].mode_infos[kFirstMode].height + | 1440 outputs_[1].mode_infos[kFirstMode].height + |
1400 OutputConfigurator::kVerticalGap, kFirstMode + 3, | 1441 OutputConfigurator::kVerticalGap, kFirstMode + 3, |
1401 outputs_[1].output).c_str(), | 1442 outputs_[1].output).c_str(), |
1402 kUngrab, kProjectingOn, NULL), | 1443 kUngrab, kProjectingOn, NULL), |
1403 delegate_->GetActionsAndClear()); | 1444 delegate_->GetActionsAndClear()); |
1404 | 1445 |
1405 } | 1446 } |
1406 | 1447 |
1407 } // namespace chromeos | 1448 } // namespace chromeos |
OLD | NEW |