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

Unified Diff: ui/display/chromeos/display_configurator_unittest.cc

Issue 652073002: chromeos: Don't apply stale display power state after resume (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a test Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/display/chromeos/display_configurator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/chromeos/display_configurator_unittest.cc
diff --git a/ui/display/chromeos/display_configurator_unittest.cc b/ui/display/chromeos/display_configurator_unittest.cc
index 7ecb1459d633dd6e212b07c1c5a0f741d6c2a284..aecaddd020cf6a50581d78c33e3e8462ce9f303d 100644
--- a/ui/display/chromeos/display_configurator_unittest.cc
+++ b/ui/display/chromeos/display_configurator_unittest.cc
@@ -1338,4 +1338,67 @@ TEST_F(DisplayConfiguratorTest, SaveDisplayPowerStateOnConfigFailure) {
log_->GetActionsAndClear());
}
+// Tests that the SetDisplayPowerState() task posted by HandleResume() doesn't
+// use a stale state if a new state is requested before it runs:
+// http://crosbug.com/p/32393
+TEST_F(DisplayConfiguratorTest, DontRestoreStalePowerStateAfterResume) {
+ // Start out with two displays in mirrored mode.
+ state_controller_.set_state(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
+ configurator_.Init(false);
+ configurator_.ForceInitialConfigure(0);
+ log_->GetActionsAndClear();
+
+ // Turn off the internal display, simulating docked mode.
+ EXPECT_TRUE(configurator_.SetDisplayPower(
+ chromeos::DISPLAY_POWER_INTERNAL_OFF_EXTERNAL_ON,
+ DisplayConfigurator::kSetDisplayPowerNoFlags));
+ EXPECT_EQ(
+ JoinActions(
+ kGrab,
+ GetFramebufferAction(big_mode_.size(), &outputs_[0], &outputs_[1])
+ .c_str(),
+ GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(),
+ GetCrtcAction(outputs_[1], &big_mode_, gfx::Point(0, 0)).c_str(),
+ kForceDPMS,
+ kUngrab,
+ NULL),
+ log_->GetActionsAndClear());
+
+ // Suspend and resume the system. Resuming should post a task to restore the
+ // previous power state, additionally forcing a probe.
+ configurator_.SuspendDisplays();
+ configurator_.ResumeDisplays();
+
+ // Before the task runs, exit docked mode.
+ EXPECT_TRUE(configurator_.SetDisplayPower(
+ chromeos::DISPLAY_POWER_ALL_ON,
+ DisplayConfigurator::kSetDisplayPowerNoFlags));
+ EXPECT_EQ(
+ JoinActions(
+ kGrab,
+ GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1])
+ .c_str(),
+ GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
+ GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
+ kForceDPMS,
+ kUngrab,
+ NULL),
+ log_->GetActionsAndClear());
+
+ // Check that the task doesn't restore the old internal-off-external-on power
+ // state.
+ EXPECT_TRUE(test_api_.TriggerConfigureTimeout());
+ EXPECT_EQ(
+ JoinActions(
+ kGrab,
+ GetFramebufferAction(small_mode_.size(), &outputs_[0], &outputs_[1])
+ .c_str(),
+ GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
+ GetCrtcAction(outputs_[1], &small_mode_, gfx::Point(0, 0)).c_str(),
+ kForceDPMS,
+ kUngrab,
+ NULL),
+ log_->GetActionsAndClear());
+}
+
} // namespace ui
« 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