| OLD | NEW |
| 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 "chrome/browser/chromeos/system/automatic_reboot_manager.h" | 5 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 void AutomaticRebootManagerBasicTest::SetUpdateRebootNeededUptime( | 367 void AutomaticRebootManagerBasicTest::SetUpdateRebootNeededUptime( |
| 368 const base::TimeDelta& uptime) { | 368 const base::TimeDelta& uptime) { |
| 369 update_reboot_needed_uptime_ = uptime; | 369 update_reboot_needed_uptime_ = uptime; |
| 370 SaveUptimeToFile(update_reboot_needed_uptime_file_, uptime); | 370 SaveUptimeToFile(update_reboot_needed_uptime_file_, uptime); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void AutomaticRebootManagerBasicTest::SetRebootAfterUpdate( | 373 void AutomaticRebootManagerBasicTest::SetRebootAfterUpdate( |
| 374 bool reboot_after_update, | 374 bool reboot_after_update, |
| 375 bool expect_reboot) { | 375 bool expect_reboot) { |
| 376 reboot_after_update_ = reboot_after_update; | 376 reboot_after_update_ = reboot_after_update; |
| 377 local_state_.SetManagedPref(prefs::kRebootAfterUpdate, | 377 local_state_.SetManagedPref( |
| 378 new base::Value(reboot_after_update)); | 378 prefs::kRebootAfterUpdate, |
| 379 base::MakeUnique<base::Value>(reboot_after_update)); |
| 379 task_runner_->RunUntilIdle(); | 380 task_runner_->RunUntilIdle(); |
| 380 EXPECT_EQ(expect_reboot ? 1 : 0, | 381 EXPECT_EQ(expect_reboot ? 1 : 0, |
| 381 power_manager_client_->num_request_restart_calls()); | 382 power_manager_client_->num_request_restart_calls()); |
| 382 } | 383 } |
| 383 | 384 |
| 384 void AutomaticRebootManagerBasicTest::SetUptimeLimit( | 385 void AutomaticRebootManagerBasicTest::SetUptimeLimit( |
| 385 const base::TimeDelta& limit, | 386 const base::TimeDelta& limit, |
| 386 bool expect_reboot) { | 387 bool expect_reboot) { |
| 387 uptime_limit_ = limit; | 388 uptime_limit_ = limit; |
| 388 if (limit.is_zero()) { | 389 if (limit.is_zero()) { |
| 389 local_state_.RemoveManagedPref(prefs::kUptimeLimit); | 390 local_state_.RemoveManagedPref(prefs::kUptimeLimit); |
| 390 } else { | 391 } else { |
| 391 local_state_.SetManagedPref( | 392 local_state_.SetManagedPref( |
| 392 prefs::kUptimeLimit, | 393 prefs::kUptimeLimit, |
| 393 new base::Value(static_cast<int>(limit.InSeconds()))); | 394 base::MakeUnique<base::Value>(static_cast<int>(limit.InSeconds()))); |
| 394 } | 395 } |
| 395 task_runner_->RunUntilIdle(); | 396 task_runner_->RunUntilIdle(); |
| 396 EXPECT_EQ(expect_reboot ? 1 : 0, | 397 EXPECT_EQ(expect_reboot ? 1 : 0, |
| 397 power_manager_client_->num_request_restart_calls()); | 398 power_manager_client_->num_request_restart_calls()); |
| 398 } | 399 } |
| 399 | 400 |
| 400 void AutomaticRebootManagerBasicTest::NotifyUpdateRebootNeeded() { | 401 void AutomaticRebootManagerBasicTest::NotifyUpdateRebootNeeded() { |
| 401 SetUpdateStatusNeedReboot(); | 402 SetUpdateStatusNeedReboot(); |
| 402 automatic_reboot_manager_->UpdateStatusChanged( | 403 automatic_reboot_manager_->UpdateStatusChanged( |
| 403 update_engine_client_->GetLastStatus()); | 404 update_engine_client_->GetLastStatus()); |
| (...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2259 AutomaticRebootManagerTestInstance, | 2260 AutomaticRebootManagerTestInstance, |
| 2260 AutomaticRebootManagerTest, | 2261 AutomaticRebootManagerTest, |
| 2261 ::testing::Values( | 2262 ::testing::Values( |
| 2262 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_LOGIN_SCREEN, | 2263 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_LOGIN_SCREEN, |
| 2263 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_KIOSK_APP_SESSION, | 2264 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_KIOSK_APP_SESSION, |
| 2264 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_ARC_KIOSK_APP_SESSION, | 2265 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_ARC_KIOSK_APP_SESSION, |
| 2265 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_NON_KIOSK_APP_SESSION)); | 2266 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_NON_KIOSK_APP_SESSION)); |
| 2266 | 2267 |
| 2267 } // namespace system | 2268 } // namespace system |
| 2268 } // namespace chromeos | 2269 } // namespace chromeos |
| OLD | NEW |