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 11 matching lines...) Expand all Loading... |
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/browser/chromeos/login/user_manager.h" | 30 #include "chrome/browser/chromeos/login/user_manager.h" |
31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
32 #include "chrome/common/chrome_paths.h" | |
33 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
34 #include "chrome/test/base/testing_browser_process.h" | 33 #include "chrome/test/base/testing_browser_process.h" |
| 34 #include "chromeos/chromeos_paths.h" |
35 #include "chromeos/dbus/dbus_thread_manager.h" | 35 #include "chromeos/dbus/dbus_thread_manager.h" |
36 #include "chromeos/dbus/mock_dbus_thread_manager.h" | 36 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
37 #include "chromeos/dbus/mock_power_manager_client.h" | 37 #include "chromeos/dbus/mock_power_manager_client.h" |
38 #include "chromeos/dbus/mock_update_engine_client.h" | 38 #include "chromeos/dbus/mock_update_engine_client.h" |
39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
40 #include "content/public/browser/notification_details.h" | 40 #include "content/public/browser/notification_details.h" |
41 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
42 #include "content/public/browser/notification_source.h" | 42 #include "content/public/browser/notification_source.h" |
43 #include "content/public/test/test_browser_thread.h" | 43 #include "content/public/test/test_browser_thread.h" |
44 #include "testing/gmock/include/gmock/gmock.h" | 44 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 void AutomaticRebootManagerBasicTest::SetUp() { | 334 void AutomaticRebootManagerBasicTest::SetUp() { |
335 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 335 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
336 const base::FilePath& temp_dir = temp_dir_.path(); | 336 const base::FilePath& temp_dir = temp_dir_.path(); |
337 const base::FilePath uptime_file = temp_dir.Append("uptime"); | 337 const base::FilePath uptime_file = temp_dir.Append("uptime"); |
338 task_runner_->SetUptimeFile(uptime_file); | 338 task_runner_->SetUptimeFile(uptime_file); |
339 ASSERT_FALSE(file_util::WriteFile(uptime_file, NULL, 0)); | 339 ASSERT_FALSE(file_util::WriteFile(uptime_file, NULL, 0)); |
340 update_reboot_needed_uptime_file_ = | 340 update_reboot_needed_uptime_file_ = |
341 temp_dir.Append("update_reboot_needed_uptime"); | 341 temp_dir.Append("update_reboot_needed_uptime"); |
342 ASSERT_FALSE(file_util::WriteFile( | 342 ASSERT_FALSE(file_util::WriteFile( |
343 update_reboot_needed_uptime_file_, NULL, 0)); | 343 update_reboot_needed_uptime_file_, NULL, 0)); |
344 ASSERT_TRUE(PathService::Override(chrome::FILE_UPTIME, uptime_file)); | 344 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPTIME, uptime_file)); |
345 ASSERT_TRUE(PathService::Override(chrome::FILE_UPDATE_REBOOT_NEEDED_UPTIME, | 345 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPDATE_REBOOT_NEEDED_UPTIME, |
346 update_reboot_needed_uptime_file_)); | 346 update_reboot_needed_uptime_file_)); |
347 | 347 |
348 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 348 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
349 AutomaticRebootManager::RegisterPrefs(local_state_.registry()); | 349 AutomaticRebootManager::RegisterPrefs(local_state_.registry()); |
350 MockDBusThreadManager* dbus_manager = new MockDBusThreadManager; | 350 MockDBusThreadManager* dbus_manager = new MockDBusThreadManager; |
351 DBusThreadManager::InitializeForTesting(dbus_manager); | 351 DBusThreadManager::InitializeForTesting(dbus_manager); |
352 power_manager_client_ = dbus_manager->mock_power_manager_client(); | 352 power_manager_client_ = dbus_manager->mock_power_manager_client(); |
353 update_engine_client_ = dbus_manager->mock_update_engine_client(); | 353 update_engine_client_ = dbus_manager->mock_update_engine_client(); |
354 | 354 |
355 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn()) | 355 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn()) |
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 // Verify that the device does not eventually reboot. | 1751 // Verify that the device does not eventually reboot. |
1752 FastForwardUntilNoTasksRemain(false); | 1752 FastForwardUntilNoTasksRemain(false); |
1753 } | 1753 } |
1754 | 1754 |
1755 INSTANTIATE_TEST_CASE_P(AutomaticRebootManagerTestInstance, | 1755 INSTANTIATE_TEST_CASE_P(AutomaticRebootManagerTestInstance, |
1756 AutomaticRebootManagerTest, | 1756 AutomaticRebootManagerTest, |
1757 ::testing::Bool()); | 1757 ::testing::Bool()); |
1758 | 1758 |
1759 } // namespace system | 1759 } // namespace system |
1760 } // namespace chromeos | 1760 } // namespace chromeos |
OLD | NEW |