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

Side by Side 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, 6 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
« no previous file with comments | « chromeos/dbus/power_policy_controller.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/dbus/power_policy_controller.h" 5 #include "chromeos/dbus/power_policy_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "chromeos/dbus/fake_power_manager_client.h" 10 #include "chromeos/dbus/fake_power_manager_client.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 policy_controller_->NotifyChromeIsExiting(); 368 policy_controller_->NotifyChromeIsExiting();
369 369
370 expected_policy.set_lid_closed_action( 370 expected_policy.set_lid_closed_action(
371 power_manager::PowerManagementPolicy_Action_DO_NOTHING); 371 power_manager::PowerManagementPolicy_Action_DO_NOTHING);
372 // Lid-closed action successfully changed to "do nothing". 372 // Lid-closed action successfully changed to "do nothing".
373 EXPECT_EQ(PowerPolicyController::GetPolicyDebugString(expected_policy), 373 EXPECT_EQ(PowerPolicyController::GetPolicyDebugString(expected_policy),
374 PowerPolicyController::GetPolicyDebugString( 374 PowerPolicyController::GetPolicyDebugString(
375 fake_power_client_->policy())); 375 fake_power_client_->policy()));
376 } 376 }
377 377
378 TEST_F(PowerPolicyControllerTest, SuspendOnLidClosedWhileSignedOut) {
379 PowerPolicyController::PrefValues prefs;
380 policy_controller_->ApplyPrefs(prefs);
381 const power_manager::PowerManagementPolicy kDefaultPolicy =
382 fake_power_client_->policy();
383
384 prefs.lid_closed_action = PowerPolicyController::ACTION_SHUT_DOWN;
385 policy_controller_->ApplyPrefs(prefs);
386
387 power_manager::PowerManagementPolicy expected_policy;
388 expected_policy = kDefaultPolicy;
389 expected_policy.set_lid_closed_action(
390 power_manager::PowerManagementPolicy_Action_SHUT_DOWN);
391 // Sanity check
392 EXPECT_EQ(PowerPolicyController::GetPolicyDebugString(expected_policy),
393 PowerPolicyController::GetPolicyDebugString(
394 fake_power_client_->policy()));
395
396 policy_controller_->SetEncryptionMigrationActive(true);
397 expected_policy.set_lid_closed_action(
398 power_manager::PowerManagementPolicy_Action_SUSPEND);
399 expected_policy.set_reason("Prefs, encryption migration");
400 // Lid-closed action successfully changed to "suspend".
401 EXPECT_EQ(PowerPolicyController::GetPolicyDebugString(expected_policy),
402 PowerPolicyController::GetPolicyDebugString(
403 fake_power_client_->policy()));
404 }
405
378 } // namespace chromeos 406 } // namespace chromeos
OLDNEW
« 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