| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/accessibility/accessibility_manager.h" | 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 6 | 6 |
| 7 #include "ash/magnifier/magnification_controller.h" | 7 #include "ash/magnifier/magnification_controller.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 void SetLargeCursorEnabled(bool enabled) { | 133 void SetLargeCursorEnabled(bool enabled) { |
| 134 return AccessibilityManager::Get()->EnableLargeCursor(enabled); | 134 return AccessibilityManager::Get()->EnableLargeCursor(enabled); |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool IsLargeCursorEnabled() { | 137 bool IsLargeCursorEnabled() { |
| 138 return AccessibilityManager::Get()->IsLargeCursorEnabled(); | 138 return AccessibilityManager::Get()->IsLargeCursorEnabled(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool ShouldShowAccessibilityMenu() { |
| 142 return AccessibilityManager::Get()->ShouldShowAccessibilityMenu(); |
| 143 } |
| 144 |
| 141 void SetHighContrastEnabled(bool enabled) { | 145 void SetHighContrastEnabled(bool enabled) { |
| 142 return AccessibilityManager::Get()->EnableHighContrast(enabled); | 146 return AccessibilityManager::Get()->EnableHighContrast(enabled); |
| 143 } | 147 } |
| 144 | 148 |
| 145 bool IsHighContrastEnabled() { | 149 bool IsHighContrastEnabled() { |
| 146 return AccessibilityManager::Get()->IsHighContrastEnabled(); | 150 return AccessibilityManager::Get()->IsHighContrastEnabled(); |
| 147 } | 151 } |
| 148 | 152 |
| 149 void SetSpokenFeedbackEnabled(bool enabled) { | 153 void SetSpokenFeedbackEnabled(bool enabled) { |
| 150 return AccessibilityManager::Get()->EnableSpokenFeedback( | 154 return AccessibilityManager::Get()->EnableSpokenFeedback( |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); | 557 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelay()); |
| 554 | 558 |
| 555 // Confirms that the prefs have been copied to the user's profile. | 559 // Confirms that the prefs have been copied to the user's profile. |
| 556 EXPECT_TRUE(GetLargeCursorEnabledFromPref()); | 560 EXPECT_TRUE(GetLargeCursorEnabledFromPref()); |
| 557 EXPECT_TRUE(GetSpokenFeedbackEnabledFromPref()); | 561 EXPECT_TRUE(GetSpokenFeedbackEnabledFromPref()); |
| 558 EXPECT_TRUE(GetHighContrastEnabledFromPref()); | 562 EXPECT_TRUE(GetHighContrastEnabledFromPref()); |
| 559 EXPECT_TRUE(GetAutoclickEnabledFromPref()); | 563 EXPECT_TRUE(GetAutoclickEnabledFromPref()); |
| 560 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelayFromPref()); | 564 EXPECT_EQ(kTestAutoclickDelayMs, GetAutoclickDelayFromPref()); |
| 561 } | 565 } |
| 562 | 566 |
| 567 IN_PROC_BROWSER_TEST_F(AccessibilityManagerTest, AcessibilityMenuVisibility) { |
| 568 // Log in. |
| 569 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); |
| 570 UserManager::Get()->SessionStarted(); |
| 571 |
| 572 // Confirms that the features are disabled. |
| 573 EXPECT_FALSE(IsLargeCursorEnabled()); |
| 574 EXPECT_FALSE(IsSpokenFeedbackEnabled()); |
| 575 EXPECT_FALSE(IsHighContrastEnabled()); |
| 576 EXPECT_FALSE(IsAutoclickEnabled()); |
| 577 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 578 |
| 579 // Check large cursor. |
| 580 SetLargeCursorEnabled(true); |
| 581 EXPECT_TRUE(ShouldShowAccessibilityMenu()); |
| 582 SetLargeCursorEnabled(false); |
| 583 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 584 |
| 585 // Check spoken feedback. |
| 586 SetSpokenFeedbackEnabled(true); |
| 587 EXPECT_TRUE(ShouldShowAccessibilityMenu()); |
| 588 SetSpokenFeedbackEnabled(false); |
| 589 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 590 |
| 591 // Check high contrast. |
| 592 SetHighContrastEnabled(true); |
| 593 EXPECT_TRUE(ShouldShowAccessibilityMenu()); |
| 594 SetHighContrastEnabled(false); |
| 595 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 596 |
| 597 // Check autoclick. |
| 598 SetAutoclickEnabled(true); |
| 599 EXPECT_TRUE(ShouldShowAccessibilityMenu()); |
| 600 SetAutoclickEnabled(false); |
| 601 EXPECT_FALSE(ShouldShowAccessibilityMenu()); |
| 602 } |
| 603 |
| 563 } // namespace chromeos | 604 } // namespace chromeos |
| OLD | NEW |