| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   366     const base::TimeDelta& uptime) { |   366     const base::TimeDelta& uptime) { | 
|   367   update_reboot_needed_uptime_ = uptime; |   367   update_reboot_needed_uptime_ = uptime; | 
|   368   SaveUptimeToFile(update_reboot_needed_uptime_file_, uptime); |   368   SaveUptimeToFile(update_reboot_needed_uptime_file_, uptime); | 
|   369 } |   369 } | 
|   370  |   370  | 
|   371 void AutomaticRebootManagerBasicTest::SetRebootAfterUpdate( |   371 void AutomaticRebootManagerBasicTest::SetRebootAfterUpdate( | 
|   372     bool reboot_after_update, |   372     bool reboot_after_update, | 
|   373     bool expect_reboot) { |   373     bool expect_reboot) { | 
|   374   reboot_after_update_ = reboot_after_update; |   374   reboot_after_update_ = reboot_after_update; | 
|   375   local_state_.SetManagedPref(prefs::kRebootAfterUpdate, |   375   local_state_.SetManagedPref(prefs::kRebootAfterUpdate, | 
|   376                               new base::FundamentalValue(reboot_after_update)); |   376                               new base::Value(reboot_after_update)); | 
|   377   task_runner_->RunUntilIdle(); |   377   task_runner_->RunUntilIdle(); | 
|   378   EXPECT_EQ(expect_reboot ? 1 : 0, |   378   EXPECT_EQ(expect_reboot ? 1 : 0, | 
|   379             power_manager_client_->num_request_restart_calls()); |   379             power_manager_client_->num_request_restart_calls()); | 
|   380 } |   380 } | 
|   381  |   381  | 
|   382 void AutomaticRebootManagerBasicTest::SetUptimeLimit( |   382 void AutomaticRebootManagerBasicTest::SetUptimeLimit( | 
|   383     const base::TimeDelta& limit, |   383     const base::TimeDelta& limit, | 
|   384     bool expect_reboot) { |   384     bool expect_reboot) { | 
|   385   uptime_limit_ = limit; |   385   uptime_limit_ = limit; | 
|   386   if (limit.is_zero()) { |   386   if (limit.is_zero()) { | 
|   387     local_state_.RemoveManagedPref(prefs::kUptimeLimit); |   387     local_state_.RemoveManagedPref(prefs::kUptimeLimit); | 
|   388   } else { |   388   } else { | 
|   389     local_state_.SetManagedPref( |   389     local_state_.SetManagedPref( | 
|   390         prefs::kUptimeLimit, |   390         prefs::kUptimeLimit, | 
|   391         new base::FundamentalValue(static_cast<int>(limit.InSeconds()))); |   391         new base::Value(static_cast<int>(limit.InSeconds()))); | 
|   392   } |   392   } | 
|   393   task_runner_->RunUntilIdle(); |   393   task_runner_->RunUntilIdle(); | 
|   394   EXPECT_EQ(expect_reboot ? 1 : 0, |   394   EXPECT_EQ(expect_reboot ? 1 : 0, | 
|   395             power_manager_client_->num_request_restart_calls()); |   395             power_manager_client_->num_request_restart_calls()); | 
|   396 } |   396 } | 
|   397  |   397  | 
|   398 void AutomaticRebootManagerBasicTest::NotifyUpdateRebootNeeded() { |   398 void AutomaticRebootManagerBasicTest::NotifyUpdateRebootNeeded() { | 
|   399   SetUpdateStatusNeedReboot(); |   399   SetUpdateStatusNeedReboot(); | 
|   400   automatic_reboot_manager_->UpdateStatusChanged( |   400   automatic_reboot_manager_->UpdateStatusChanged( | 
|   401       update_engine_client_->GetLastStatus()); |   401       update_engine_client_->GetLastStatus()); | 
| (...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2277 INSTANTIATE_TEST_CASE_P( |  2277 INSTANTIATE_TEST_CASE_P( | 
|  2278     AutomaticRebootManagerTestInstance, |  2278     AutomaticRebootManagerTestInstance, | 
|  2279     AutomaticRebootManagerTest, |  2279     AutomaticRebootManagerTest, | 
|  2280     ::testing::Values( |  2280     ::testing::Values( | 
|  2281         AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_LOGIN_SCREEN, |  2281         AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_LOGIN_SCREEN, | 
|  2282         AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_KIOSK_APP_SESSION, |  2282         AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_KIOSK_APP_SESSION, | 
|  2283         AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_NON_KIOSK_APP_SESSION)); |  2283         AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_NON_KIOSK_APP_SESSION)); | 
|  2284  |  2284  | 
|  2285 }  // namespace system |  2285 }  // namespace system | 
|  2286 }  // namespace chromeos |  2286 }  // namespace chromeos | 
| OLD | NEW |