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_settings.h" | 5 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/chromeos/settings/cros_settings.h" | 11 #include "chrome/browser/chromeos/settings/cros_settings.h" |
12 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 12 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
13 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 13 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
14 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 14 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
15 #include "content/public/test/test_browser_thread.h" | 15 #include "content/public/test/test_browser_thread.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 const int kFudgeInt = 100; | 20 const int kFudgeInt = 100; |
21 | 21 |
22 } | 22 } |
23 | 23 |
24 namespace chromeos { | 24 namespace chromeos { |
25 | 25 |
26 class KioskModeSettingsTest : public testing::Test { | 26 class KioskModeSettingsTest : public testing::Test { |
27 protected: | 27 protected: |
28 KioskModeSettingsTest() | 28 KioskModeSettingsTest() |
29 : message_loop_(MessageLoop::TYPE_UI), | 29 : message_loop_(base::MessageLoop::TYPE_UI), |
30 ui_thread_(content::BrowserThread::UI, &message_loop_), | 30 ui_thread_(content::BrowserThread::UI, &message_loop_), |
31 file_thread_(content::BrowserThread::FILE, &message_loop_) { | 31 file_thread_(content::BrowserThread::FILE, &message_loop_) { |
32 CrosSettings* cros_settings = CrosSettings::Get(); | 32 CrosSettings* cros_settings = CrosSettings::Get(); |
33 | 33 |
34 // Remove the real DeviceSettingsProvider and replace it with a stub. | 34 // Remove the real DeviceSettingsProvider and replace it with a stub. |
35 device_settings_provider_ = | 35 device_settings_provider_ = |
36 cros_settings->GetProvider(chromeos::kReportDeviceVersionInfo); | 36 cros_settings->GetProvider(chromeos::kReportDeviceVersionInfo); |
37 EXPECT_TRUE(device_settings_provider_ != NULL); | 37 EXPECT_TRUE(device_settings_provider_ != NULL); |
38 EXPECT_TRUE( | 38 EXPECT_TRUE( |
39 cros_settings->RemoveSettingsProvider(device_settings_provider_)); | 39 cros_settings->RemoveSettingsProvider(device_settings_provider_)); |
(...skipping 23 matching lines...) Expand all Loading... |
63 | 63 |
64 void ReInitialize() { | 64 void ReInitialize() { |
65 KioskModeSettings::Get()->set_initialized(false); | 65 KioskModeSettings::Get()->set_initialized(false); |
66 KioskModeSettings::Get()->Initialize(base::Bind(&base::DoNothing)); | 66 KioskModeSettings::Get()->Initialize(base::Bind(&base::DoNothing)); |
67 } | 67 } |
68 | 68 |
69 void DisableKioskModeSettings() { | 69 void DisableKioskModeSettings() { |
70 KioskModeSettings::Get()->set_initialized(false); | 70 KioskModeSettings::Get()->set_initialized(false); |
71 } | 71 } |
72 | 72 |
73 MessageLoop message_loop_; | 73 base::MessageLoop message_loop_; |
74 content::TestBrowserThread ui_thread_; | 74 content::TestBrowserThread ui_thread_; |
75 content::TestBrowserThread file_thread_; | 75 content::TestBrowserThread file_thread_; |
76 | 76 |
77 ScopedTestDeviceSettingsService test_device_settings_service_; | 77 ScopedTestDeviceSettingsService test_device_settings_service_; |
78 ScopedTestCrosSettings test_cros_settings_; | 78 ScopedTestCrosSettings test_cros_settings_; |
79 | 79 |
80 CrosSettingsProvider* device_settings_provider_; | 80 CrosSettingsProvider* device_settings_provider_; |
81 StubCrosSettingsProvider stub_settings_provider_; | 81 StubCrosSettingsProvider stub_settings_provider_; |
82 }; | 82 }; |
83 | 83 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Time delta initializes to '0' microseconds. | 158 // Time delta initializes to '0' microseconds. |
159 EXPECT_LT(KioskModeSettings::Get()->GetScreensaverTimeout(), | 159 EXPECT_LT(KioskModeSettings::Get()->GetScreensaverTimeout(), |
160 base::TimeDelta()); | 160 base::TimeDelta()); |
161 EXPECT_LT(KioskModeSettings::Get()->GetIdleLogoutTimeout(), | 161 EXPECT_LT(KioskModeSettings::Get()->GetIdleLogoutTimeout(), |
162 base::TimeDelta()); | 162 base::TimeDelta()); |
163 EXPECT_LT(KioskModeSettings::Get()->GetIdleLogoutWarningDuration(), | 163 EXPECT_LT(KioskModeSettings::Get()->GetIdleLogoutWarningDuration(), |
164 base::TimeDelta()); | 164 base::TimeDelta()); |
165 } | 165 } |
166 | 166 |
167 } // namespace chromeos | 167 } // namespace chromeos |
OLD | NEW |