| 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" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 14 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| 15 #include "components/user_manager/user_manager.h" | 15 #include "components/user_manager/user_manager.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "ui/wm/core/user_activity_detector.h" | 19 #include "ui/wm/core/user_activity_detector.h" |
| 20 | 20 |
| 21 namespace chromeos { | 21 namespace chromeos { |
| 22 | 22 |
| 23 class KioskModeIdleLogoutTest : public ash::test::AshTestBase { | 23 class KioskModeIdleLogoutTest : public ash::test::AshTestBase { |
| 24 public: | 24 public: |
| 25 KioskModeIdleLogoutTest() | 25 KioskModeIdleLogoutTest() |
| 26 : idle_logout_(NULL) { | 26 : idle_logout_(NULL) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual void SetUp() OVERRIDE { | 29 virtual void SetUp() override { |
| 30 AshTestBase::SetUp(); | 30 AshTestBase::SetUp(); |
| 31 idle_logout_ = new KioskModeIdleLogout(); | 31 idle_logout_ = new KioskModeIdleLogout(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual void TearDown() OVERRIDE { | 34 virtual void TearDown() override { |
| 35 delete idle_logout_; | 35 delete idle_logout_; |
| 36 AshTestBase::TearDown(); | 36 AshTestBase::TearDown(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool LoginUserObserverRegistered() { | 39 bool LoginUserObserverRegistered() { |
| 40 return idle_logout_->registrar_.IsRegistered( | 40 return idle_logout_->registrar_.IsRegistered( |
| 41 idle_logout_, | 41 idle_logout_, |
| 42 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 42 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 43 content::NotificationService::AllSources()); | 43 content::NotificationService::AllSources()); |
| 44 } | 44 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 70 // checking for the current logged in user in our observer anyway, giving | 70 // checking for the current logged in user in our observer anyway, giving |
| 71 // NoDetails here is fine. | 71 // NoDetails here is fine. |
| 72 content::NotificationService::NoDetails()); | 72 content::NotificationService::NoDetails()); |
| 73 | 73 |
| 74 RunAllPendingInMessageLoop(); | 74 RunAllPendingInMessageLoop(); |
| 75 EXPECT_FALSE(LoginUserObserverRegistered()); | 75 EXPECT_FALSE(LoginUserObserverRegistered()); |
| 76 EXPECT_TRUE(UserActivityObserverRegistered()); | 76 EXPECT_TRUE(UserActivityObserverRegistered()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace chromeos | 79 } // namespace chromeos |
| OLD | NEW |