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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/run_loop.h" | 21 #include "base/run_loop.h" |
22 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
24 #include "base/test/simple_test_tick_clock.h" | 24 #include "base/test/simple_test_tick_clock.h" |
25 #include "base/thread_task_runner_handle.h" | 25 #include "base/thread_task_runner_handle.h" |
26 #include "base/threading/sequenced_worker_pool.h" | 26 #include "base/threading/sequenced_worker_pool.h" |
27 #include "base/time/tick_clock.h" | 27 #include "base/time/tick_clock.h" |
28 #include "base/values.h" | 28 #include "base/values.h" |
29 #include "chrome/browser/chromeos/login/mock_user_manager.h" | 29 #include "chrome/browser/chromeos/login/mock_user_manager.h" |
30 #include "chrome/common/chrome_notification_types.h" | 30 #include "chrome/common/chrome_notification_types.h" |
31 #include "chrome/common/chrome_paths.h" | |
32 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
33 #include "chrome/test/base/testing_browser_process.h" | 32 #include "chrome/test/base/testing_browser_process.h" |
| 33 #include "chromeos/chromeos_paths.h" |
34 #include "chromeos/dbus/dbus_thread_manager.h" | 34 #include "chromeos/dbus/dbus_thread_manager.h" |
35 #include "chromeos/dbus/mock_dbus_thread_manager.h" | 35 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
36 #include "chromeos/dbus/mock_power_manager_client.h" | 36 #include "chromeos/dbus/mock_power_manager_client.h" |
37 #include "chromeos/dbus/mock_update_engine_client.h" | 37 #include "chromeos/dbus/mock_update_engine_client.h" |
38 #include "content/public/browser/browser_thread.h" | 38 #include "content/public/browser/browser_thread.h" |
39 #include "content/public/browser/notification_details.h" | 39 #include "content/public/browser/notification_details.h" |
40 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
41 #include "content/public/browser/notification_source.h" | 41 #include "content/public/browser/notification_source.h" |
42 #include "content/public/test/test_browser_thread.h" | 42 #include "content/public/test/test_browser_thread.h" |
43 #include "testing/gmock/include/gmock/gmock.h" | 43 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 void AutomaticRebootManagerBasicTest::SetUp() { | 330 void AutomaticRebootManagerBasicTest::SetUp() { |
331 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 331 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
332 const base::FilePath& temp_dir = temp_dir_.path(); | 332 const base::FilePath& temp_dir = temp_dir_.path(); |
333 const base::FilePath uptime_file = temp_dir.Append("uptime"); | 333 const base::FilePath uptime_file = temp_dir.Append("uptime"); |
334 task_runner_->SetUptimeFile(uptime_file); | 334 task_runner_->SetUptimeFile(uptime_file); |
335 ASSERT_FALSE(file_util::WriteFile(uptime_file, NULL, 0)); | 335 ASSERT_FALSE(file_util::WriteFile(uptime_file, NULL, 0)); |
336 update_reboot_needed_uptime_file_ = | 336 update_reboot_needed_uptime_file_ = |
337 temp_dir.Append("update_reboot_needed_uptime"); | 337 temp_dir.Append("update_reboot_needed_uptime"); |
338 ASSERT_FALSE(file_util::WriteFile( | 338 ASSERT_FALSE(file_util::WriteFile( |
339 update_reboot_needed_uptime_file_, NULL, 0)); | 339 update_reboot_needed_uptime_file_, NULL, 0)); |
340 ASSERT_TRUE(PathService::Override(chrome::FILE_UPTIME, uptime_file)); | 340 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPTIME, uptime_file)); |
341 ASSERT_TRUE(PathService::Override(chrome::FILE_UPDATE_REBOOT_NEEDED_UPTIME, | 341 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPDATE_REBOOT_NEEDED_UPTIME, |
342 update_reboot_needed_uptime_file_)); | 342 update_reboot_needed_uptime_file_)); |
343 | 343 |
344 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 344 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
345 AutomaticRebootManager::RegisterPrefs(local_state_.registry()); | 345 AutomaticRebootManager::RegisterPrefs(local_state_.registry()); |
346 MockDBusThreadManager* dbus_manager = new MockDBusThreadManager; | 346 MockDBusThreadManager* dbus_manager = new MockDBusThreadManager; |
347 DBusThreadManager::InitializeForTesting(dbus_manager); | 347 DBusThreadManager::InitializeForTesting(dbus_manager); |
348 power_manager_client_ = dbus_manager->mock_power_manager_client(); | 348 power_manager_client_ = dbus_manager->mock_power_manager_client(); |
349 update_engine_client_ = dbus_manager->mock_update_engine_client(); | 349 update_engine_client_ = dbus_manager->mock_update_engine_client(); |
350 | 350 |
351 EXPECT_CALL(*scoped_mock_user_manager_enabler_.user_manager(), | 351 EXPECT_CALL(*scoped_mock_user_manager_enabler_.user_manager(), |
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 // Verify that the device does not eventually reboot. | 1748 // Verify that the device does not eventually reboot. |
1749 FastForwardUntilNoTasksRemain(false); | 1749 FastForwardUntilNoTasksRemain(false); |
1750 } | 1750 } |
1751 | 1751 |
1752 INSTANTIATE_TEST_CASE_P(AutomaticRebootManagerTestInstance, | 1752 INSTANTIATE_TEST_CASE_P(AutomaticRebootManagerTestInstance, |
1753 AutomaticRebootManagerTest, | 1753 AutomaticRebootManagerTest, |
1754 ::testing::Bool()); | 1754 ::testing::Bool()); |
1755 | 1755 |
1756 } // namespace system | 1756 } // namespace system |
1757 } // namespace chromeos | 1757 } // namespace chromeos |
OLD | NEW |