Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: chrome/browser/chromeos/system/automatic_reboot_manager_unittest.cc

Issue 477663004: Merged FakedDBusThreadManager with DBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 15 matching lines...) Expand all
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/chrome_notification_types.h" 29 #include "chrome/browser/chrome_notification_types.h"
30 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" 30 #include "chrome/browser/chromeos/login/users/mock_user_manager.h"
31 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 31 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
32 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
33 #include "chrome/test/base/testing_browser_process.h" 33 #include "chrome/test/base/testing_browser_process.h"
34 #include "chromeos/chromeos_paths.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/fake_dbus_thread_manager.h"
37 #include "chromeos/dbus/fake_power_manager_client.h" 36 #include "chromeos/dbus/fake_power_manager_client.h"
38 #include "chromeos/dbus/fake_update_engine_client.h" 37 #include "chromeos/dbus/fake_update_engine_client.h"
39 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
40 #include "content/public/browser/notification_details.h" 39 #include "content/public/browser/notification_details.h"
41 #include "content/public/browser/notification_service.h" 40 #include "content/public/browser/notification_service.h"
42 #include "content/public/browser/notification_source.h" 41 #include "content/public/browser/notification_source.h"
43 #include "content/public/test/test_browser_thread.h" 42 #include "content/public/test/test_browser_thread.h"
44 #include "testing/gmock/include/gmock/gmock.h" 43 #include "testing/gmock/include/gmock/gmock.h"
45 #include "testing/gtest/include/gtest/gtest.h" 44 #include "testing/gtest/include/gtest/gtest.h"
46 #include "ui/message_center/message_center.h" 45 #include "ui/message_center/message_center.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 update_reboot_needed_uptime_file_ = 349 update_reboot_needed_uptime_file_ =
351 temp_dir.Append("update_reboot_needed_uptime"); 350 temp_dir.Append("update_reboot_needed_uptime");
352 ASSERT_FALSE(base::WriteFile(update_reboot_needed_uptime_file_, NULL, 0)); 351 ASSERT_FALSE(base::WriteFile(update_reboot_needed_uptime_file_, NULL, 0));
353 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPTIME, uptime_file)); 352 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPTIME, uptime_file));
354 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPDATE_REBOOT_NEEDED_UPTIME, 353 ASSERT_TRUE(PathService::Override(chromeos::FILE_UPDATE_REBOOT_NEEDED_UPTIME,
355 update_reboot_needed_uptime_file_)); 354 update_reboot_needed_uptime_file_));
356 355
357 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); 356 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_);
358 AutomaticRebootManager::RegisterPrefs(local_state_.registry()); 357 AutomaticRebootManager::RegisterPrefs(local_state_.registry());
359 358
360 FakeDBusThreadManager* dbus_manager = new FakeDBusThreadManager; 359 scoped_ptr<DBusThreadManagerSetter> dbus_setter =
360 chromeos::DBusThreadManager::GetSetterForTesting();
361 power_manager_client_ = new FakePowerManagerClient; 361 power_manager_client_ = new FakePowerManagerClient;
362 dbus_manager->SetPowerManagerClient( 362 dbus_setter->SetPowerManagerClient(
363 scoped_ptr<PowerManagerClient>(power_manager_client_)); 363 scoped_ptr<PowerManagerClient>(power_manager_client_));
364 update_engine_client_ = new FakeUpdateEngineClient; 364 update_engine_client_ = new FakeUpdateEngineClient;
365 dbus_manager->SetUpdateEngineClient( 365 dbus_setter->SetUpdateEngineClient(
366 scoped_ptr<UpdateEngineClient>(update_engine_client_)); 366 scoped_ptr<UpdateEngineClient>(update_engine_client_));
367 DBusThreadManager::InitializeForTesting(dbus_manager);
368 367
369 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn()) 368 EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn())
370 .WillRepeatedly(ReturnPointee(&is_user_logged_in_)); 369 .WillRepeatedly(ReturnPointee(&is_user_logged_in_));
371 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsKioskApp()) 370 EXPECT_CALL(*mock_user_manager_, IsLoggedInAsKioskApp())
372 .WillRepeatedly(ReturnPointee(&is_logged_in_as_kiosk_app_)); 371 .WillRepeatedly(ReturnPointee(&is_logged_in_as_kiosk_app_));
373 } 372 }
374 373
375 void AutomaticRebootManagerBasicTest::TearDown() { 374 void AutomaticRebootManagerBasicTest::TearDown() {
376 // Let the AutomaticRebootManager, if any, unregister itself as an observer of 375 // Let the AutomaticRebootManager, if any, unregister itself as an observer of
377 // several subsystems. 376 // several subsystems.
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 INSTANTIATE_TEST_CASE_P( 2052 INSTANTIATE_TEST_CASE_P(
2054 AutomaticRebootManagerTestInstance, 2053 AutomaticRebootManagerTestInstance,
2055 AutomaticRebootManagerTest, 2054 AutomaticRebootManagerTest,
2056 ::testing::Values( 2055 ::testing::Values(
2057 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_LOGIN_SCREEN, 2056 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_LOGIN_SCREEN,
2058 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_KIOSK_APP_SESSION, 2057 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_KIOSK_APP_SESSION,
2059 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_NON_KIOSK_APP_SESSION)); 2058 AUTOMATIC_REBOOT_MANAGER_TEST_SCENARIO_NON_KIOSK_APP_SESSION));
2060 2059
2061 } // namespace system 2060 } // namespace system
2062 } // namespace chromeos 2061 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698