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

Unified Diff: chromeos/dbus/power_policy_controller_unittest.cc

Issue 2912763003: cros: Prevent shut down on lid-close during migration. (Closed)
Patch Set: revert unrelated change Created 3 years, 7 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 | « chromeos/dbus/power_policy_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/power_policy_controller_unittest.cc
diff --git a/chromeos/dbus/power_policy_controller_unittest.cc b/chromeos/dbus/power_policy_controller_unittest.cc
index 255117e00e8515075da4c2e7b47b4f82055fc196..acff4a36fb5c524835ba99854b2f3b31b00f5f7f 100644
--- a/chromeos/dbus/power_policy_controller_unittest.cc
+++ b/chromeos/dbus/power_policy_controller_unittest.cc
@@ -375,4 +375,32 @@ TEST_F(PowerPolicyControllerTest, DoNothingOnLidClosedWhileSigningOut) {
fake_power_client_->policy()));
}
+TEST_F(PowerPolicyControllerTest, SuspendOnLidClosedWhileSignedOut) {
+ PowerPolicyController::PrefValues prefs;
+ policy_controller_->ApplyPrefs(prefs);
+ const power_manager::PowerManagementPolicy kDefaultPolicy =
+ fake_power_client_->policy();
+
+ prefs.lid_closed_action = PowerPolicyController::ACTION_SHUT_DOWN;
+ policy_controller_->ApplyPrefs(prefs);
+
+ power_manager::PowerManagementPolicy expected_policy;
+ expected_policy = kDefaultPolicy;
+ expected_policy.set_lid_closed_action(
+ power_manager::PowerManagementPolicy_Action_SHUT_DOWN);
+ // Sanity check
+ EXPECT_EQ(PowerPolicyController::GetPolicyDebugString(expected_policy),
+ PowerPolicyController::GetPolicyDebugString(
+ fake_power_client_->policy()));
+
+ policy_controller_->SetEncryptionMigrationActive(true);
+ expected_policy.set_lid_closed_action(
+ power_manager::PowerManagementPolicy_Action_SUSPEND);
+ expected_policy.set_reason("Prefs, encryption migration");
+ // Lid-closed action successfully changed to "suspend".
+ EXPECT_EQ(PowerPolicyController::GetPolicyDebugString(expected_policy),
+ PowerPolicyController::GetPolicyDebugString(
+ fake_power_client_->policy()));
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos/dbus/power_policy_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698