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

Side by Side Diff: chrome/browser/chromeos/policy/recommendation_restorer_unittest.cc

Issue 2078393005: mash: Move accessibility_types.h from ui namespace to ash namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a11y
Patch Set: fix chromevox code generated from js Created 4 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/policy/recommendation_restorer.h" 5 #include "chrome/browser/chromeos/policy/recommendation_restorer.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/accessibility_types.h" 10 #include "ash/common/accessibility_types.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 recommended_prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, 124 recommended_prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled,
125 false); 125 false);
126 } 126 }
127 127
128 void RecommendationRestorerTest::SetUserSettings() { 128 void RecommendationRestorerTest::SetUserSettings() {
129 prefs_->SetBoolean(prefs::kAccessibilityLargeCursorEnabled, true); 129 prefs_->SetBoolean(prefs::kAccessibilityLargeCursorEnabled, true);
130 prefs_->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled, true); 130 prefs_->SetBoolean(prefs::kAccessibilitySpokenFeedbackEnabled, true);
131 prefs_->SetBoolean(prefs::kAccessibilityHighContrastEnabled, true); 131 prefs_->SetBoolean(prefs::kAccessibilityHighContrastEnabled, true);
132 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true); 132 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true);
133 prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType, 133 prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType,
134 ui::MAGNIFIER_FULL); 134 ash::MAGNIFIER_FULL);
135 prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, true); 135 prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, true);
136 } 136 }
137 137
138 void RecommendationRestorerTest::CreateLoginProfile() { 138 void RecommendationRestorerTest::CreateLoginProfile() {
139 ASSERT_FALSE(restorer_); 139 ASSERT_FALSE(restorer_);
140 TestingProfile* profile = profile_manager_.CreateTestingProfile( 140 TestingProfile* profile = profile_manager_.CreateTestingProfile(
141 chrome::kInitialProfile, std::move(prefs_owner_), 141 chrome::kInitialProfile, std::move(prefs_owner_),
142 base::UTF8ToUTF16(chrome::kInitialProfile), 0, std::string(), 142 base::UTF8ToUTF16(chrome::kInitialProfile), 0, std::string(),
143 TestingProfile::TestingFactories()); 143 TestingProfile::TestingFactories());
144 restorer_ = RecommendationRestorerFactory::GetForProfile(profile); 144 restorer_ = RecommendationRestorerFactory::GetForProfile(profile);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void RecommendationRestorerTest::VerifyPrefsFollowUser() const { 181 void RecommendationRestorerTest::VerifyPrefsFollowUser() const {
182 VerifyPrefFollowsUser(prefs::kAccessibilityLargeCursorEnabled, 182 VerifyPrefFollowsUser(prefs::kAccessibilityLargeCursorEnabled,
183 base::FundamentalValue(true)); 183 base::FundamentalValue(true));
184 VerifyPrefFollowsUser(prefs::kAccessibilitySpokenFeedbackEnabled, 184 VerifyPrefFollowsUser(prefs::kAccessibilitySpokenFeedbackEnabled,
185 base::FundamentalValue(true)); 185 base::FundamentalValue(true));
186 VerifyPrefFollowsUser(prefs::kAccessibilityHighContrastEnabled, 186 VerifyPrefFollowsUser(prefs::kAccessibilityHighContrastEnabled,
187 base::FundamentalValue(true)); 187 base::FundamentalValue(true));
188 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled, 188 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled,
189 base::FundamentalValue(true)); 189 base::FundamentalValue(true));
190 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType, 190 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType,
191 base::FundamentalValue(ui::MAGNIFIER_FULL)); 191 base::FundamentalValue(ash::MAGNIFIER_FULL));
192 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled, 192 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled,
193 base::FundamentalValue(true)); 193 base::FundamentalValue(true));
194 } 194 }
195 195
196 void RecommendationRestorerTest::VerifyPrefFollowsRecommendation( 196 void RecommendationRestorerTest::VerifyPrefFollowsRecommendation(
197 const char* pref_name, 197 const char* pref_name,
198 const base::Value& expected_value) const { 198 const base::Value& expected_value) const {
199 const syncable_prefs::PrefServiceSyncable::Preference* pref = 199 const syncable_prefs::PrefServiceSyncable::Preference* pref =
200 prefs_->FindPreference(pref_name); 200 prefs_->FindPreference(pref_name);
201 ASSERT_TRUE(pref); 201 ASSERT_TRUE(pref);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled, 318 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled,
319 base::FundamentalValue(false)); 319 base::FundamentalValue(false));
320 320
321 VerifyTimerIsStopped(); 321 VerifyTimerIsStopped();
322 recommended_prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, 322 recommended_prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled,
323 false); 323 false);
324 recommended_prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType, 0); 324 recommended_prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType, 0);
325 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled, 325 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled,
326 base::FundamentalValue(true)); 326 base::FundamentalValue(true));
327 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType, 327 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType,
328 base::FundamentalValue(ui::MAGNIFIER_FULL)); 328 base::FundamentalValue(ash::MAGNIFIER_FULL));
329 VerifyTimerIsRunning(); 329 VerifyTimerIsRunning();
330 runner_->RunUntilIdle(); 330 runner_->RunUntilIdle();
331 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled, 331 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled,
332 base::FundamentalValue(false)); 332 base::FundamentalValue(false));
333 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType, 333 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType,
334 base::FundamentalValue(0)); 334 base::FundamentalValue(0));
335 VerifyTimerIsStopped(); 335 VerifyTimerIsStopped();
336 recommended_prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, 336 recommended_prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled,
337 false); 337 false);
338 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled, 338 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 base::FundamentalValue(true)); 373 base::FundamentalValue(true));
374 recommended_prefs_->SetBoolean(prefs::kAccessibilityHighContrastEnabled, 374 recommended_prefs_->SetBoolean(prefs::kAccessibilityHighContrastEnabled,
375 false); 375 false);
376 VerifyTimerIsStopped(); 376 VerifyTimerIsStopped();
377 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled, 377 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled,
378 base::FundamentalValue(false)); 378 base::FundamentalValue(false));
379 379
380 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled, 380 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled,
381 base::FundamentalValue(true)); 381 base::FundamentalValue(true));
382 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType, 382 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType,
383 base::FundamentalValue(ui::MAGNIFIER_FULL)); 383 base::FundamentalValue(ash::MAGNIFIER_FULL));
384 recommended_prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, 384 recommended_prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled,
385 false); 385 false);
386 recommended_prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType, 0); 386 recommended_prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType, 0);
387 VerifyTimerIsStopped(); 387 VerifyTimerIsStopped();
388 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled, 388 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled,
389 base::FundamentalValue(false)); 389 base::FundamentalValue(false));
390 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType, 390 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType,
391 base::FundamentalValue(0)); 391 base::FundamentalValue(0));
392 392
393 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled, 393 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled,
(...skipping 27 matching lines...) Expand all
421 base::FundamentalValue(true)); 421 base::FundamentalValue(true));
422 VerifyTimerIsStopped(); 422 VerifyTimerIsStopped();
423 423
424 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true); 424 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true);
425 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled, 425 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled,
426 base::FundamentalValue(true)); 426 base::FundamentalValue(true));
427 VerifyTimerIsStopped(); 427 VerifyTimerIsStopped();
428 428
429 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true); 429 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true);
430 prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType, 430 prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType,
431 ui::MAGNIFIER_FULL); 431 ash::MAGNIFIER_FULL);
432 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled, 432 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled,
433 base::FundamentalValue(true)); 433 base::FundamentalValue(true));
434 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType, 434 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType,
435 base::FundamentalValue(ui::MAGNIFIER_FULL)); 435 base::FundamentalValue(ash::MAGNIFIER_FULL));
436 VerifyTimerIsStopped(); 436 VerifyTimerIsStopped();
437 437
438 prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, true); 438 prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, true);
439 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled, 439 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled,
440 base::FundamentalValue(true)); 440 base::FundamentalValue(true));
441 VerifyTimerIsStopped(); 441 VerifyTimerIsStopped();
442 } 442 }
443 443
444 TEST_F(RecommendationRestorerTest, RestoreOnUserChange) { 444 TEST_F(RecommendationRestorerTest, RestoreOnUserChange) {
445 // Verifies that if recommended values have been set and user settings change 445 // Verifies that if recommended values have been set and user settings change
(...skipping 27 matching lines...) Expand all
473 VerifyPrefFollowsUser(prefs::kAccessibilityHighContrastEnabled, 473 VerifyPrefFollowsUser(prefs::kAccessibilityHighContrastEnabled,
474 base::FundamentalValue(true)); 474 base::FundamentalValue(true));
475 VerifyTimerIsRunning(); 475 VerifyTimerIsRunning();
476 runner_->RunUntilIdle(); 476 runner_->RunUntilIdle();
477 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled, 477 VerifyPrefFollowsRecommendation(prefs::kAccessibilityHighContrastEnabled,
478 base::FundamentalValue(false)); 478 base::FundamentalValue(false));
479 479
480 VerifyTimerIsStopped(); 480 VerifyTimerIsStopped();
481 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true); 481 prefs_->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, true);
482 prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType, 482 prefs_->SetInteger(prefs::kAccessibilityScreenMagnifierType,
483 ui::MAGNIFIER_FULL); 483 ash::MAGNIFIER_FULL);
484 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled, 484 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierEnabled,
485 base::FundamentalValue(true)); 485 base::FundamentalValue(true));
486 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType, 486 VerifyPrefFollowsUser(prefs::kAccessibilityScreenMagnifierType,
487 base::FundamentalValue(ui::MAGNIFIER_FULL)); 487 base::FundamentalValue(ash::MAGNIFIER_FULL));
488 VerifyTimerIsRunning(); 488 VerifyTimerIsRunning();
489 runner_->RunUntilIdle(); 489 runner_->RunUntilIdle();
490 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled, 490 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierEnabled,
491 base::FundamentalValue(false)); 491 base::FundamentalValue(false));
492 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType, 492 VerifyPrefFollowsRecommendation(prefs::kAccessibilityScreenMagnifierType,
493 base::FundamentalValue(0)); 493 base::FundamentalValue(0));
494 494
495 VerifyTimerIsStopped(); 495 VerifyTimerIsStopped();
496 prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, true); 496 prefs_->SetBoolean(prefs::kAccessibilityVirtualKeyboardEnabled, true);
497 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled, 497 VerifyPrefFollowsUser(prefs::kAccessibilityVirtualKeyboardEnabled,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 554
555 // Fast forward until the reset timer fires. 555 // Fast forward until the reset timer fires.
556 VerifyTimerIsRunning(); 556 VerifyTimerIsRunning();
557 runner_->RunUntilIdle(); 557 runner_->RunUntilIdle();
558 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled, 558 VerifyPrefFollowsRecommendation(prefs::kAccessibilityLargeCursorEnabled,
559 base::FundamentalValue(false)); 559 base::FundamentalValue(false));
560 VerifyTimerIsStopped(); 560 VerifyTimerIsStopped();
561 } 561 }
562 562
563 } // namespace policy 563 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/login_screen_default_policy_browsertest.cc ('k') | chrome/browser/chromeos/preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698