OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/kiosk_mode/kiosk_mode_idle_logout.h" | 5 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_idle_logout.h" |
6 | 6 |
7 #include "ash/shell.h" | |
8 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
9 #include "base/bind.h" | 8 #include "base/bind.h" |
10 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
12 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 13 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
15 #include "components/user_manager/user_manager.h" | 14 #include "components/user_manager/user_manager.h" |
16 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
17 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
(...skipping 19 matching lines...) Expand all Loading... |
37 } | 36 } |
38 | 37 |
39 bool LoginUserObserverRegistered() { | 38 bool LoginUserObserverRegistered() { |
40 return idle_logout_->registrar_.IsRegistered( | 39 return idle_logout_->registrar_.IsRegistered( |
41 idle_logout_, | 40 idle_logout_, |
42 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 41 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
43 content::NotificationService::AllSources()); | 42 content::NotificationService::AllSources()); |
44 } | 43 } |
45 | 44 |
46 bool UserActivityObserverRegistered() { | 45 bool UserActivityObserverRegistered() { |
47 return ash::Shell::GetInstance()->user_activity_detector()->HasObserver( | 46 return wm::UserActivityDetector::Get()->HasObserver(idle_logout_); |
48 idle_logout_); | |
49 } | 47 } |
50 | 48 |
51 ScopedDeviceSettingsTestHelper device_settings_test_helper_; | 49 ScopedDeviceSettingsTestHelper device_settings_test_helper_; |
52 | 50 |
53 KioskModeIdleLogout* idle_logout_; | 51 KioskModeIdleLogout* idle_logout_; |
54 content::NotificationRegistrar registrar_; | 52 content::NotificationRegistrar registrar_; |
55 }; | 53 }; |
56 | 54 |
57 // http://crbug.com/177918 | 55 // http://crbug.com/177918 |
58 TEST_F(KioskModeIdleLogoutTest, DISABLED_CheckObserversBeforeUserLogin) { | 56 TEST_F(KioskModeIdleLogoutTest, DISABLED_CheckObserversBeforeUserLogin) { |
(...skipping 11 matching lines...) Expand all Loading... |
70 // checking for the current logged in user in our observer anyway, giving | 68 // checking for the current logged in user in our observer anyway, giving |
71 // NoDetails here is fine. | 69 // NoDetails here is fine. |
72 content::NotificationService::NoDetails()); | 70 content::NotificationService::NoDetails()); |
73 | 71 |
74 RunAllPendingInMessageLoop(); | 72 RunAllPendingInMessageLoop(); |
75 EXPECT_FALSE(LoginUserObserverRegistered()); | 73 EXPECT_FALSE(LoginUserObserverRegistered()); |
76 EXPECT_TRUE(UserActivityObserverRegistered()); | 74 EXPECT_TRUE(UserActivityObserverRegistered()); |
77 } | 75 } |
78 | 76 |
79 } // namespace chromeos | 77 } // namespace chromeos |
OLD | NEW |