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

Side by Side Diff: chromeos/display/output_configurator_unittest.cc

Issue 139053003: Chrome OS: avoid suspending on lid close when casting is active. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments and add unit test. Created 6 years, 11 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
« chromeos/DEPS ('K') | « chromeos/display/output_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 (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
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, ScreenSharing) {
791 InitWithSingleOutput();
792
793 content::MediaStreamDevice capture_device(
794 content::MEDIA_DESKTOP_VIDEO_CAPTURE, std::string(), "screen sharing");
795
796 // Notify configurator that screen sharing session is started.
797 configurator_.OnRequestUpdate(
798 0, 0, capture_device, content::MEDIA_REQUEST_STATE_DONE);
799 EXPECT_EQ(JoinActions(kProjectingOn, NULL), delegate_->GetActionsAndClear());
800
801 // Turn all displays off and check that projecting is not turned off.
802 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_OFF,
803 OutputConfigurator::kSetDisplayPowerNoFlags);
804 EXPECT_EQ(JoinActions(kGrab,
805 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight,
806 outputs_[0].crtc, 0).c_str(),
807 GetCrtcAction(outputs_[0].crtc, 0, 0, 0,
808 outputs_[0].output).c_str(),
809 kUngrab, NULL),
810 delegate_->GetActionsAndClear());
811
812 // Turn all displays back on.
813 configurator_.SetDisplayPower(DISPLAY_POWER_ALL_ON,
814 OutputConfigurator::kSetDisplayPowerNoFlags);
815 EXPECT_EQ(JoinActions(kGrab,
816 GetFramebufferAction(kSmallModeWidth, kSmallModeHeight,
817 outputs_[0].crtc, 0).c_str(),
818 GetCrtcAction(outputs_[0].crtc, 0, 0, kSmallModeId,
819 outputs_[0].output).c_str(),
820 kForceDPMS, kUngrab, NULL),
821 delegate_->GetActionsAndClear());
822
823 // Notify configurator that screen sharing session is ended.
824 configurator_.OnRequestUpdate(
825 0, 0, capture_device, content::MEDIA_REQUEST_STATE_CLOSING);
826 EXPECT_EQ(JoinActions(kProjectingOff, NULL), delegate_->GetActionsAndClear());
827 }
828
790 TEST_F(OutputConfiguratorTest, SuspendAndResume) { 829 TEST_F(OutputConfiguratorTest, SuspendAndResume) {
791 InitWithSingleOutput(); 830 InitWithSingleOutput();
792 831
793 // No preparation is needed before suspending when the display is already 832 // No preparation is needed before suspending when the display is already
794 // on. The configurator should still reprobe on resume in case a display 833 // on. The configurator should still reprobe on resume in case a display
795 // was connected while suspended. 834 // was connected while suspended.
796 configurator_.SuspendDisplays(); 835 configurator_.SuspendDisplays();
797 EXPECT_EQ(kNoActions, delegate_->GetActionsAndClear()); 836 EXPECT_EQ(kNoActions, delegate_->GetActionsAndClear());
798 configurator_.ResumeDisplays(); 837 configurator_.ResumeDisplays();
799 EXPECT_EQ(JoinActions(kGrab, 838 EXPECT_EQ(JoinActions(kGrab,
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 GetCrtcAction(outputs_[1].crtc, 0, 1437 GetCrtcAction(outputs_[1].crtc, 0,
1399 outputs_[1].mode_infos[kFirstMode].height + 1438 outputs_[1].mode_infos[kFirstMode].height +
1400 OutputConfigurator::kVerticalGap, kFirstMode + 3, 1439 OutputConfigurator::kVerticalGap, kFirstMode + 3,
1401 outputs_[1].output).c_str(), 1440 outputs_[1].output).c_str(),
1402 kUngrab, kProjectingOn, NULL), 1441 kUngrab, kProjectingOn, NULL),
1403 delegate_->GetActionsAndClear()); 1442 delegate_->GetActionsAndClear());
1404 1443
1405 } 1444 }
1406 1445
1407 } // namespace chromeos 1446 } // namespace chromeos
OLDNEW
« chromeos/DEPS ('K') | « chromeos/display/output_configurator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698