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

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

Issue 932203002: Move check for suspended displays out of common path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: check that SetDisplayPower and SetDisplayMode still work Created 5 years, 10 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 86b147338ec939a4595f929a6f4fb490d1ac79a1..9e40fda1c73abaccda678be965d29f5dc0b472f9 100644
--- a/ui/display/chromeos/display_configurator_unittest.cc
+++ b/ui/display/chromeos/display_configurator_unittest.cc
@@ -975,10 +975,59 @@ TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) {
configurator_.SuspendDisplays();
EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
+ // The configuration timer should not be started when the displays
+ // are suspended.
configurator_.OnConfigurationChanged();
- EXPECT_TRUE(test_api_.TriggerConfigureTimeout());
+ EXPECT_FALSE(test_api_.TriggerConfigureTimeout());
EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
+ // Calls to SetDisplayPower and SetDisplayMode should be successful.
+ configurator_.SetDisplayPower(
+ chromeos::DISPLAY_POWER_ALL_OFF,
+ DisplayConfigurator::kSetDisplayPowerNoFlags,
+ base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback,
+ base::Unretained(this)));
+ EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
+ EXPECT_EQ(
+ JoinActions(
+ kGrab,
+ GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(),
+ GetCrtcAction(outputs_[0], NULL, gfx::Point(0, 0)).c_str(),
+ kUngrab,
+ NULL),
+ log_->GetActionsAndClear());
+ configurator_.SetDisplayPower(
+ chromeos::DISPLAY_POWER_ALL_ON,
+ DisplayConfigurator::kSetDisplayPowerNoFlags,
+ base::Bind(&DisplayConfiguratorTest::OnConfiguredCallback,
+ base::Unretained(this)));
+ EXPECT_EQ(CALLBACK_SUCCESS, PopCallbackResult());
+ EXPECT_EQ(
+ JoinActions(
+ kGrab,
+ GetFramebufferAction(small_mode_.size(), &outputs_[0], NULL).c_str(),
+ GetCrtcAction(outputs_[0], &small_mode_, gfx::Point(0, 0)).c_str(),
+ kForceDPMS,
+ kUngrab,
+ NULL),
+ log_->GetActionsAndClear());
+
+ UpdateOutputs(2, false);
+ configurator_.SetDisplayMode(MULTIPLE_DISPLAY_STATE_DUAL_MIRROR);
+ 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(),
+ kUngrab,
+ NULL),
+ log_->GetActionsAndClear());
+
+ // The DisplayConfigurator should force a probe and reconfiguration at resume
+ // time.
+ UpdateOutputs(1, false);
configurator_.ResumeDisplays();
EXPECT_TRUE(test_api_.TriggerConfigureTimeout());
EXPECT_EQ(
@@ -992,12 +1041,12 @@ TEST_F(DisplayConfiguratorTest, DoNotConfigureWithSuspendedDisplays) {
log_->GetActionsAndClear());
// If a configuration task is pending when the displays are suspended, that
- // task should not run either.
+ // task should not run either and the timer should be stopped.
configurator_.OnConfigurationChanged();
configurator_.SuspendDisplays();
EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
- EXPECT_TRUE(test_api_.TriggerConfigureTimeout());
+ EXPECT_FALSE(test_api_.TriggerConfigureTimeout());
EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
configurator_.ResumeDisplays();
« 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