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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 update_reboot_needed_uptime_file_ = | 351 update_reboot_needed_uptime_file_ = |
352 temp_dir.Append("update_reboot_needed_uptime"); | 352 temp_dir.Append("update_reboot_needed_uptime"); |
353 ASSERT_FALSE(file_util::WriteFile( | 353 ASSERT_FALSE(file_util::WriteFile( |
354 update_reboot_needed_uptime_file_, NULL, 0)); | 354 update_reboot_needed_uptime_file_, NULL, 0)); |
355 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPTIME, uptime_file)); | 355 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPTIME, uptime_file)); |
356 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPDATE_REBOOT_NEEDED_UPTIME, | 356 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPDATE_REBOOT_NEEDED_UPTIME, |
357 update_reboot_needed_uptime_file_)); | 357 update_reboot_needed_uptime_file_)); |
358 | 358 |
359 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 359 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
360 AutomaticRebootManager::RegisterPrefs(local_state_.registry()); | 360 AutomaticRebootManager::RegisterPrefs(local_state_.registry()); |
| 361 |
361 FakeDBusThreadManager* dbus_manager = new FakeDBusThreadManager; | 362 FakeDBusThreadManager* dbus_manager = new FakeDBusThreadManager; |
| 363 power_manager_client_ = new FakePowerManagerClient; |
| 364 dbus_manager->SetPowerManagerClient( |
| 365 scoped_ptr<PowerManagerClient>(power_manager_client_)); |
| 366 update_engine_client_ = new FakeUpdateEngineClient; |
| 367 dbus_manager->SetUpdateEngineClient( |
| 368 scoped_ptr<UpdateEngineClient>(update_engine_client_)); |
362 DBusThreadManager::InitializeForTesting(dbus_manager); | 369 DBusThreadManager::InitializeForTesting(dbus_manager); |
363 power_manager_client_ = dbus_manager->fake_power_manager_client(); | |
364 update_engine_client_ = dbus_manager->fake_update_engine_client(); | |
365 | 370 |
366 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn()) | 371 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn()) |
367 .WillRepeatedly(ReturnPointee(&is_user_logged_in_)); | 372 .WillRepeatedly(ReturnPointee(&is_user_logged_in_)); |
368 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsKioskApp()) | 373 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsKioskApp()) |
369 .WillRepeatedly(ReturnPointee(&is_logged_in_as_kiosk_app_)); | 374 .WillRepeatedly(ReturnPointee(&is_logged_in_as_kiosk_app_)); |
370 } | 375 } |
371 | 376 |
372 void AutomaticRebootManagerBasicTest::TearDown() { | 377 void AutomaticRebootManagerBasicTest::TearDown() { |
373 // Let the AutomaticRebootManager, if any, unregister itself as an observer of | 378 // Let the AutomaticRebootManager, if any, unregister itself as an observer of |
374 // several subsystems. | 379 // several subsystems. |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 INSTANTIATE_TEST_CASE_P( | 2056 INSTANTIATE_TEST_CASE_P( |
2052 AutomaticRebootManagerTestInstance, | 2057 AutomaticRebootManagerTestInstance, |
2053 AutomaticRebootManagerTest, | 2058 AutomaticRebootManagerTest, |
2054 ::testing::Values( | 2059 ::testing::Values( |
2055 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_LOGIN_SCREEN, | 2060 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_LOGIN_SCREEN, |
2056 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_KIOSK_APP_SESSION, | 2061 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_KIOSK_APP_SESSION, |
2057 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_NON_KIOSK_APP_SESSION)); | 2062 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_NON_KIOSK_APP_SESSION)); |
2058 | 2063 |
2059 } // namespace system | 2064 } // namespace system |
2060 } // namespace chromeos | 2065 } // namespace chromeos |
OLD | NEW |