1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/policy/recommendation_restorer.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/prefs/pref_notifier_impl.h"
9 #include "base/prefs/testing_pref_store.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "base/test/test_simple_task_runner.h"
12 #include "base/thread_task_runner_handle.h"
13 #include "base/time/time.h"
14 #include "base/values.h"
15 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/chromeos/policy/recommendation_restorer_factory.h"
17 #include "chrome/browser/prefs/browser_prefs.h"
18 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/pref_names.h"
20 #include "chrome/test/base/testing_browser_process.h"
21 #include "chrome/test/base/testing_profile.h"
22 #include "chrome/test/base/testing_profile_manager.h"
23 #include "components/pref_registry/pref_registry_syncable.h"
24 #include "components/syncable_prefs/pref_service_syncable.h"
25 #include "components/syncable_prefs/testing_pref_service_syncable.h"
26 #include "content/public/browser/notification_details.h"
27 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/notification_source.h"
29 #include "testing/gtest/include/gtest/gtest.h"
30 #include "ui/chromeos/accessibility_types.h"
35 // The amount of idle time after which recommended values are restored.
36 const int kRestoreDelayInMs
= 60 * 1000; // 1 minute.
39 class RecommendationRestorerTest
: public testing::Test
{
41 RecommendationRestorerTest();
44 void SetUp() override
;
46 void RegisterUserProfilePrefs();
47 void RegisterLoginProfilePrefs();
49 void SetRecommendedValues();
50 void SetUserSettings();
52 void CreateLoginProfile();
53 void CreateUserProfile();
55 void NotifyOfSessionStart();
56 void NotifyOfUserActivity();
58 void VerifyPrefFollowsUser(const char* pref_name
,
59 const base::Value
& expected_value
) const;
60 void VerifyPrefsFollowUser() const;
61 void VerifyPrefFollowsRecommendation(const char* pref_name
,
62 const base::Value
& expected_value
) const;
63 void VerifyPrefsFollowRecommendations() const;
65 void VerifyNotListeningForNotifications() const;
66 void VerifyTimerIsStopped() const;
67 void VerifyTimerIsRunning() const;
69 TestingPrefStore
* recommended_prefs_
; // Not owned.
70 syncable_prefs::TestingPrefServiceSyncable
* prefs_
; // Not owned.
71 RecommendationRestorer
* restorer_
; // Not owned.
73 scoped_refptr
<base::TestSimpleTaskRunner
> runner_
;
74 base::ThreadTaskRunnerHandle runner_handler_
;
77 scoped_ptr
<syncable_prefs::PrefServiceSyncable
> prefs_owner_
;
79 TestingProfileManager profile_manager_
;
81 DISALLOW_COPY_AND_ASSIGN(RecommendationRestorerTest
);
84 RecommendationRestorerTest::RecommendationRestorerTest()
85 : recommended_prefs_(new TestingPrefStore
),
86 prefs_(new syncable_prefs::TestingPrefServiceSyncable(
90 new user_prefs::PrefRegistrySyncable
,
91 new PrefNotifierImpl
)),
93 runner_(new base::TestSimpleTaskRunner
),
94 runner_handler_(runner_
),
96 profile_manager_(TestingBrowserProcess::GetGlobal()) {}
98 void RecommendationRestorerTest::SetUp() {
99 testing::Test::SetUp();
100 ASSERT_TRUE(profile_manager_
.SetUp());
103 void RecommendationRestorerTest::RegisterUserProfilePrefs() {
104 chrome::RegisterUserProfilePrefs(prefs_
->registry());
107 void RecommendationRestorerTest::RegisterLoginProfilePrefs() {
108 chrome::RegisterLoginProfilePrefs(prefs_
->registry());
111 void RecommendationRestorerTest::SetRecommendedValues() {
112 recommended_prefs_
->SetBoolean(prefs::kAccessibilityLargeCursorEnabled
,
114 recommended_prefs_
->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled
,
116 recommended_prefs_
->SetBoolean(prefs::kAccessibilityHighContrastEnabled
,
118 recommended_prefs_
->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled
,
120 recommended_prefs_
->SetInteger(prefs::kAccessibilityScreenMagnifierType
, 0);
121 recommended_prefs_
->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled
,
125 void RecommendationRestorerTest::SetUserSettings() {
126 prefs_
->SetBoolean(prefs::kAccessibilityLargeCursorEnabled
, true);
127 prefs_
->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled
, true);
128 prefs_
->SetBoolean(prefs::kAccessibilityHighContrastEnabled
, true);
129 prefs_
->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled
, true);
130 prefs_
->SetInteger(prefs::kAccessibilityScreenMagnifierType
,
132 prefs_
->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled
, true);
135 void RecommendationRestorerTest::CreateLoginProfile() {
136 ASSERT_FALSE(restorer_
);
137 TestingProfile
* profile
= profile_manager_
.CreateTestingProfile(
138 chrome::kInitialProfile
, prefs_owner_
.Pass(),
139 base::UTF8ToUTF16(chrome::kInitialProfile
), 0, std::string(),
140 TestingProfile::TestingFactories());
141 restorer_
= RecommendationRestorerFactory::GetForProfile(profile
);
142 EXPECT_TRUE(restorer_
);
145 void RecommendationRestorerTest::CreateUserProfile() {
146 ASSERT_FALSE(restorer_
);
147 TestingProfile
* profile
= profile_manager_
.CreateTestingProfile(
148 "user", prefs_owner_
.Pass(), base::UTF8ToUTF16("user"), 0, std::string(),
149 TestingProfile::TestingFactories());
150 restorer_
= RecommendationRestorerFactory::GetForProfile(profile
);
151 EXPECT_TRUE(restorer_
);
154 void RecommendationRestorerTest::NotifyOfSessionStart() {
155 ASSERT_TRUE(restorer_
);
156 restorer_
->Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED
,
157 content::Source
<RecommendationRestorerTest
>(this),
158 content::NotificationService::NoDetails());
161 void RecommendationRestorerTest::NotifyOfUserActivity() {
162 ASSERT_TRUE(restorer_
);
163 restorer_
->OnUserActivity(NULL
);
166 void RecommendationRestorerTest::VerifyPrefFollowsUser(
167 const char* pref_name
,
168 const base::Value
& expected_value
) const {
169 const syncable_prefs::PrefServiceSyncable::Preference
* pref
=
170 prefs_
->FindPreference(pref_name
);
172 EXPECT_TRUE(pref
->HasUserSetting());
173 const base::Value
* value
= pref
->GetValue();
175 EXPECT_TRUE(expected_value
.Equals(value
));
178 void RecommendationRestorerTest::VerifyPrefsFollowUser() const {
179 VerifyPrefFollowsUser(prefs::kAccessibilityLargeCursorEnabled
,
180 base::FundamentalValue(true));
181 VerifyPrefFollowsUser(prefs::kAccessibilitySpokenFeedbackEnabled
,
182 base::FundamentalValue(true));
183 VerifyPrefFollowsUser(prefs::kAccessibilityHighContrastEnabled
,
184 base::FundamentalValue(true));
185 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled
,
186 base::FundamentalValue(true));
187 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType
,
188 base::FundamentalValue(ui::MAGNIFIER_FULL
));
189 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled
,
190 base::FundamentalValue(true));
193 void RecommendationRestorerTest::VerifyPrefFollowsRecommendation(
194 const char* pref_name
,
195 const base::Value
& expected_value
) const {
196 const syncable_prefs::PrefServiceSyncable::Preference
* pref
=
197 prefs_
->FindPreference(pref_name
);
199 EXPECT_TRUE(pref
->IsRecommended());
200 EXPECT_FALSE(pref
->HasUserSetting());
201 const base::Value
* value
= pref
->GetValue();
203 EXPECT_TRUE(expected_value
.Equals(value
));
206 void RecommendationRestorerTest::VerifyPrefsFollowRecommendations() const {
207 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled
,
208 base::FundamentalValue(false));
209 VerifyPrefFollowsRecommendation(prefs::kAccessibilitySpokenFeedbackEnabled
,
210 base::FundamentalValue(false));
211 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled
,
212 base::FundamentalValue(false));
213 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled
,
214 base::FundamentalValue(false));
215 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType
,
216 base::FundamentalValue(0));
217 VerifyPrefFollowsRecommendation(prefs::kAccessibilityVirtualKeyboardEnabled
,
218 base::FundamentalValue(false));
221 void RecommendationRestorerTest::VerifyNotListeningForNotifications() const {
222 ASSERT_TRUE(restorer_
);
223 EXPECT_TRUE(restorer_
->pref_change_registrar_
.IsEmpty());
224 EXPECT_TRUE(restorer_
->notification_registrar_
.IsEmpty());
227 void RecommendationRestorerTest::VerifyTimerIsStopped() const {
228 ASSERT_TRUE(restorer_
);
229 EXPECT_FALSE(restorer_
->restore_timer_
.IsRunning());
232 void RecommendationRestorerTest::VerifyTimerIsRunning() const {
233 ASSERT_TRUE(restorer_
);
234 EXPECT_TRUE(restorer_
->restore_timer_
.IsRunning());
235 EXPECT_EQ(base::TimeDelta::FromMilliseconds(kRestoreDelayInMs
),
236 restorer_
->restore_timer_
.GetCurrentDelay());
239 TEST_F(RecommendationRestorerTest
, CreateForUserProfile
) {
240 // Verifies that when a RecommendationRestorer is created for a user profile,
241 // it does not start listening for any notifications, does not clear user
242 // settings on initialization and does not start a timer that will clear user
243 // settings eventually.
244 RegisterUserProfilePrefs();
245 SetRecommendedValues();
249 VerifyNotListeningForNotifications();
250 VerifyPrefsFollowUser();
251 VerifyTimerIsStopped();
254 TEST_F(RecommendationRestorerTest
, NoRecommendations
) {
255 // Verifies that when no recommended values have been set and a
256 // RecommendationRestorer is created for the login profile, it does not clear
257 // user settings on initialization and does not start a timer that will clear
258 // user settings eventually.
259 RegisterLoginProfilePrefs();
262 CreateLoginProfile();
263 VerifyPrefsFollowUser();
264 VerifyTimerIsStopped();
267 TEST_F(RecommendationRestorerTest
, RestoreOnStartup
) {
268 // Verifies that when recommended values have been set and a
269 // RecommendationRestorer is created for the login profile, it clears user
270 // settings on initialization.
271 RegisterLoginProfilePrefs();
272 SetRecommendedValues();
275 CreateLoginProfile();
276 VerifyPrefsFollowRecommendations();
277 VerifyTimerIsStopped();
280 TEST_F(RecommendationRestorerTest
, RestoreOnRecommendationChangeOnLoginScreen
) {
281 // Verifies that if recommended values change while the login screen is being
282 // shown, a timer is started that will clear user settings eventually.
283 RegisterLoginProfilePrefs();
286 CreateLoginProfile();
288 VerifyTimerIsStopped();
289 recommended_prefs_
->SetBoolean(prefs::kAccessibilityLargeCursorEnabled
,
291 VerifyPrefFollowsUser(prefs::kAccessibilityLargeCursorEnabled
,
292 base::FundamentalValue(true));
293 VerifyTimerIsRunning();
294 runner_
->RunUntilIdle();
295 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled
,
296 base::FundamentalValue(false));
298 VerifyTimerIsStopped();
299 recommended_prefs_
->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled
,
301 VerifyPrefFollowsUser(prefs::kAccessibilitySpokenFeedbackEnabled
,
302 base::FundamentalValue(true));
303 VerifyTimerIsRunning();
304 runner_
->RunUntilIdle();
305 VerifyPrefFollowsRecommendation(prefs::kAccessibilitySpokenFeedbackEnabled
,
306 base::FundamentalValue(false));
308 VerifyTimerIsStopped();
309 recommended_prefs_
->SetBoolean(prefs::kAccessibilityHighContrastEnabled
,
311 VerifyPrefFollowsUser(prefs::kAccessibilityHighContrastEnabled
,
312 base::FundamentalValue(true));
313 VerifyTimerIsRunning();
314 runner_
->RunUntilIdle();
315 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled
,
316 base::FundamentalValue(false));
318 VerifyTimerIsStopped();
319 recommended_prefs_
->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled
,
321 recommended_prefs_
->SetInteger(prefs::kAccessibilityScreenMagnifierType
, 0);
322 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled
,
323 base::FundamentalValue(true));
324 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType
,
325 base::FundamentalValue(ui::MAGNIFIER_FULL
));
326 VerifyTimerIsRunning();
327 runner_
->RunUntilIdle();
328 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled
,
329 base::FundamentalValue(false));
330 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType
,
331 base::FundamentalValue(0));
332 VerifyTimerIsStopped();
333 recommended_prefs_
->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled
,
335 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled
,
336 base::FundamentalValue(true));
337 VerifyTimerIsRunning();
338 runner_
->RunUntilIdle();
339 VerifyPrefFollowsRecommendation(prefs::kAccessibilityVirtualKeyboardEnabled
,
340 base::FundamentalValue(false));
341 VerifyTimerIsStopped();
344 TEST_F(RecommendationRestorerTest
, RestoreOnRecommendationChangeInUserSession
) {
345 // Verifies that if recommended values change while a user session is in
346 // progress, user settings are cleared immediately.
347 RegisterLoginProfilePrefs();
350 CreateLoginProfile();
351 NotifyOfSessionStart();
353 VerifyPrefFollowsUser(prefs::kAccessibilityLargeCursorEnabled
,
354 base::FundamentalValue(true));
355 recommended_prefs_
->SetBoolean(prefs::kAccessibilityLargeCursorEnabled
,
357 VerifyTimerIsStopped();
358 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled
,
359 base::FundamentalValue(false));
361 VerifyPrefFollowsUser(prefs::kAccessibilitySpokenFeedbackEnabled
,
362 base::FundamentalValue(true));
363 recommended_prefs_
->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled
,
365 VerifyTimerIsStopped();
366 VerifyPrefFollowsRecommendation(prefs::kAccessibilitySpokenFeedbackEnabled
,
367 base::FundamentalValue(false));
369 VerifyPrefFollowsUser(prefs::kAccessibilityHighContrastEnabled
,
370 base::FundamentalValue(true));
371 recommended_prefs_
->SetBoolean(prefs::kAccessibilityHighContrastEnabled
,
373 VerifyTimerIsStopped();
374 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled
,
375 base::FundamentalValue(false));
377 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled
,
378 base::FundamentalValue(true));
379 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType
,
380 base::FundamentalValue(ui::MAGNIFIER_FULL
));
381 recommended_prefs_
->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled
,
383 recommended_prefs_
->SetInteger(prefs::kAccessibilityScreenMagnifierType
, 0);
384 VerifyTimerIsStopped();
385 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled
,
386 base::FundamentalValue(false));
387 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType
,
388 base::FundamentalValue(0));
390 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled
,
391 base::FundamentalValue(true));
392 recommended_prefs_
->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled
,
394 VerifyTimerIsStopped();
395 VerifyPrefFollowsRecommendation(prefs::kAccessibilityVirtualKeyboardEnabled
,
396 base::FundamentalValue(false));
399 TEST_F(RecommendationRestorerTest
, DoNothingOnUserChange
) {
400 // Verifies that if no recommended values have been set and user settings
401 // change, the user settings are not cleared immediately and no timer is
402 // started that will clear the user settings eventually.
403 RegisterLoginProfilePrefs();
404 CreateLoginProfile();
406 prefs_
->SetBoolean(prefs::kAccessibilityLargeCursorEnabled
, true);
407 VerifyPrefFollowsUser(prefs::kAccessibilityLargeCursorEnabled
,
408 base::FundamentalValue(true));
409 VerifyTimerIsStopped();
411 prefs_
->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled
, true);
412 VerifyPrefFollowsUser(prefs::kAccessibilitySpokenFeedbackEnabled
,
413 base::FundamentalValue(true));
414 VerifyTimerIsStopped();
416 prefs_
->SetBoolean(prefs::kAccessibilityHighContrastEnabled
, true);
417 VerifyPrefFollowsUser(prefs::kAccessibilityHighContrastEnabled
,
418 base::FundamentalValue(true));
419 VerifyTimerIsStopped();
421 prefs_
->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled
, true);
422 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled
,
423 base::FundamentalValue(true));
424 VerifyTimerIsStopped();
426 prefs_
->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled
, true);
427 prefs_
->SetInteger(prefs::kAccessibilityScreenMagnifierType
,
429 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled
,
430 base::FundamentalValue(true));
431 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType
,
432 base::FundamentalValue(ui::MAGNIFIER_FULL
));
433 VerifyTimerIsStopped();
435 prefs_
->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled
, true);
436 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled
,
437 base::FundamentalValue(true));
438 VerifyTimerIsStopped();
441 TEST_F(RecommendationRestorerTest
, RestoreOnUserChange
) {
442 // Verifies that if recommended values have been set and user settings change
443 // while the login screen is being shown, a timer is started that will clear
444 // the user settings eventually.
445 RegisterLoginProfilePrefs();
446 SetRecommendedValues();
448 CreateLoginProfile();
450 VerifyTimerIsStopped();
451 prefs_
->SetBoolean(prefs::kAccessibilityLargeCursorEnabled
, true);
452 VerifyPrefFollowsUser(prefs::kAccessibilityLargeCursorEnabled
,
453 base::FundamentalValue(true));
454 VerifyTimerIsRunning();
455 runner_
->RunUntilIdle();
456 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled
,
457 base::FundamentalValue(false));
459 VerifyTimerIsStopped();
460 prefs_
->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled
, true);
461 VerifyPrefFollowsUser(prefs::kAccessibilitySpokenFeedbackEnabled
,
462 base::FundamentalValue(true));
463 VerifyTimerIsRunning();
464 runner_
->RunUntilIdle();
465 VerifyPrefFollowsRecommendation(prefs::kAccessibilitySpokenFeedbackEnabled
,
466 base::FundamentalValue(false));
468 VerifyTimerIsStopped();
469 prefs_
->SetBoolean(prefs::kAccessibilityHighContrastEnabled
, true);
470 VerifyPrefFollowsUser(prefs::kAccessibilityHighContrastEnabled
,
471 base::FundamentalValue(true));
472 VerifyTimerIsRunning();
473 runner_
->RunUntilIdle();
474 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled
,
475 base::FundamentalValue(false));
477 VerifyTimerIsStopped();
478 prefs_
->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled
, true);
479 prefs_
->SetInteger(prefs::kAccessibilityScreenMagnifierType
,
481 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled
,
482 base::FundamentalValue(true));
483 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType
,
484 base::FundamentalValue(ui::MAGNIFIER_FULL
));
485 VerifyTimerIsRunning();
486 runner_
->RunUntilIdle();
487 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled
,
488 base::FundamentalValue(false));
489 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType
,
490 base::FundamentalValue(0));
492 VerifyTimerIsStopped();
493 prefs_
->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled
, true);
494 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled
,
495 base::FundamentalValue(true));
496 VerifyTimerIsRunning();
497 runner_
->RunUntilIdle();
498 VerifyPrefFollowsRecommendation(prefs::kAccessibilityVirtualKeyboardEnabled
,
499 base::FundamentalValue(false));
501 VerifyTimerIsStopped();
504 TEST_F(RecommendationRestorerTest
, RestoreOnSessionStart
) {
505 // Verifies that if recommended values have been set, user settings have
506 // changed and a session is then started, the user settings are cleared
507 // immediately and the timer that would have cleared them eventually on the
508 // login screen is stopped.
509 RegisterLoginProfilePrefs();
510 SetRecommendedValues();
512 CreateLoginProfile();
515 NotifyOfSessionStart();
516 VerifyPrefsFollowRecommendations();
517 VerifyTimerIsStopped();
520 TEST_F(RecommendationRestorerTest
, DoNothingOnSessionStart
) {
521 // Verifies that if recommended values have not been set, user settings have
522 // changed and a session is then started, the user settings are not cleared
524 RegisterLoginProfilePrefs();
525 CreateLoginProfile();
528 NotifyOfSessionStart();
529 VerifyPrefsFollowUser();
530 VerifyTimerIsStopped();
533 TEST_F(RecommendationRestorerTest
, UserActivityResetsTimer
) {
534 // Verifies that user activity resets the timer which clears user settings.
535 RegisterLoginProfilePrefs();
537 recommended_prefs_
->SetBoolean(prefs::kAccessibilityLargeCursorEnabled
,
540 CreateLoginProfile();
542 prefs_
->SetBoolean(prefs::kAccessibilityLargeCursorEnabled
, true);
543 VerifyTimerIsRunning();
545 // Notify that there is user activity, then fast forward until the originally
547 NotifyOfUserActivity();
548 runner_
->RunPendingTasks();
549 VerifyPrefFollowsUser(prefs::kAccessibilityLargeCursorEnabled
,
550 base::FundamentalValue(true));
552 // Fast forward until the reset timer fires.
553 VerifyTimerIsRunning();
554 runner_
->RunUntilIdle();
555 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled
,
556 base::FundamentalValue(false));
557 VerifyTimerIsStopped();
560 } // namespace policy