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

Unified Diff: chrome/browser/chromeos/system/tray_accessibility_browsertest.cc

Issue 14200048: Introduce AcccessibilityManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments & minor fix Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
diff --git a/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc b/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
index fd68b4fdcdb9728b41f6972cb5bb31629c635212..a9e9a179be283b000c73668d493ad4bbf8da4e0f 100644
--- a/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
+++ b/chrome/browser/chromeos/system/tray_accessibility_browsertest.cc
@@ -11,7 +11,7 @@
#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/accessibility/accessibility_util.h"
+#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
#include "chrome/browser/chromeos/login/helper.h"
@@ -149,15 +149,17 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) {
EXPECT_FALSE(IsTrayIconVisible());
// Toggling spoken feedback changes the visibillity of the icon.
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(IsTrayIconVisible());
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_FALSE(IsTrayIconVisible());
// Toggling high contrast the visibillity of the icon.
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(IsTrayIconVisible());
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_FALSE(IsTrayIconVisible());
// Toggling magnifier the visibillity of the icon.
@@ -169,13 +171,15 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) {
// Enabling all accessibility features.
SetMagnifierEnabled(true);
EXPECT_TRUE(IsTrayIconVisible());
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(IsTrayIconVisible());
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(IsTrayIconVisible());
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(IsTrayIconVisible());
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_TRUE(IsTrayIconVisible());
SetMagnifierEnabled(false);
EXPECT_FALSE(IsTrayIconVisible());
@@ -186,9 +190,9 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowTrayIcon) {
PrefService* prefs = profile->GetPrefs();
prefs->SetBoolean(prefs::kShouldAlwaysShowAccessibilityMenu, true);
prefs->CommitPendingWrite();
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(IsTrayIconVisible());
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_FALSE(IsTrayIconVisible());
}
@@ -208,15 +212,17 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) {
EXPECT_FALSE(CanCreateMenuItem());
// Toggling spoken feedback changes the visibillity of the menu.
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_FALSE(CanCreateMenuItem());
// Toggling high contrast changes the visibillity of the menu.
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_FALSE(CanCreateMenuItem());
// Toggling screen magnifier changes the visibillity of the menu.
@@ -228,13 +234,15 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenu) {
// Enabling all accessibility features.
SetMagnifierEnabled(true);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_TRUE(CanCreateMenuItem());
SetMagnifierEnabled(false);
EXPECT_FALSE(CanCreateMenuItem());
@@ -256,15 +264,17 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
EXPECT_TRUE(CanCreateMenuItem());
// The menu is keeping visible regardless of toggling spoken feedback.
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
// The menu is keeping visible regardless of toggling high contrast.
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_TRUE(CanCreateMenuItem());
// The menu is keeping visible regardless of toggling screen magnifier.
@@ -276,13 +286,15 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowMenuOption) {
// Enabling all accessibility features.
SetMagnifierEnabled(true);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_TRUE(CanCreateMenuItem());
SetMagnifierEnabled(false);
EXPECT_TRUE(CanCreateMenuItem());
@@ -301,15 +313,17 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
EXPECT_TRUE(CanCreateMenuItem());
// The menu is keeping visible regardless of toggling spoken feedback.
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
// The menu is keeping visible regardless of toggling high contrast.
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_TRUE(CanCreateMenuItem());
// The menu is keeping visible regardless of toggling screen magnifier.
@@ -321,13 +335,15 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
// Enabling all accessibility features.
SetMagnifierEnabled(true);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CanCreateMenuItem());
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_TRUE(CanCreateMenuItem());
SetMagnifierEnabled(false);
EXPECT_TRUE(CanCreateMenuItem());
@@ -351,7 +367,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, ShowMenuWithShowOnLoginScreen) {
IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) {
// Enables high contrast mode.
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(CanCreateMenuItem());
// Locks the screen.
@@ -359,7 +375,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) {
EXPECT_TRUE(CanCreateMenuItem());
// Disables high contrast mode.
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
// Confirms that the menu is still visible.
EXPECT_TRUE(CanCreateMenuItem());
@@ -373,29 +389,29 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, KeepMenuVisibilityOnLockScreen) {
IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, MAYBE_ClickDetailMenu) {
// Confirms that the check item toggles the spoken feedback.
- EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled());
+ EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
EXPECT_TRUE(CreateDetailedMenu());
ClickSpokenFeedbackOnDetailMenu();
- EXPECT_TRUE(accessibility::IsSpokenFeedbackEnabled());
+ EXPECT_TRUE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
EXPECT_TRUE(CreateDetailedMenu());
ClickSpokenFeedbackOnDetailMenu();
- EXPECT_FALSE(accessibility::IsSpokenFeedbackEnabled());
+ EXPECT_FALSE(AccessibilityManager::Get()->IsSpokenFeedbackEnabled());
// Confirms that the check item toggles the high contrast.
- EXPECT_FALSE(accessibility::IsHighContrastEnabled());
+ EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
EXPECT_TRUE(CreateDetailedMenu());
ClickHighContrastOnDetailMenu();
- EXPECT_TRUE(accessibility::IsHighContrastEnabled());
+ EXPECT_TRUE(AccessibilityManager::Get()->IsHighContrastEnabled());
EXPECT_TRUE(CreateDetailedMenu());
ClickHighContrastOnDetailMenu();
- EXPECT_FALSE(accessibility::IsHighContrastEnabled());
+ EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
// Confirms that the check item toggles the magnifier.
- EXPECT_FALSE(accessibility::IsHighContrastEnabled());
+ EXPECT_FALSE(AccessibilityManager::Get()->IsHighContrastEnabled());
EXPECT_FALSE(MagnificationManager::Get()->IsMagnifierEnabled());
EXPECT_TRUE(CreateDetailedMenu());
@@ -416,7 +432,8 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
CloseDetailMenu();
// Enabling spoken feedback.
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CreateDetailedMenu());
EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
@@ -424,7 +441,8 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
CloseDetailMenu();
// Disabling spoken feedback.
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
EXPECT_TRUE(CreateDetailedMenu());
EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
@@ -432,7 +450,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
CloseDetailMenu();
// Enabling high contrast.
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableHighContrast(true);
EXPECT_TRUE(CreateDetailedMenu());
EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
EXPECT_TRUE(IsHighContrastEnabledOnDetailMenu());
@@ -440,7 +458,7 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
CloseDetailMenu();
// Disabling high contrast.
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableHighContrast(false);
EXPECT_TRUE(CreateDetailedMenu());
EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());
EXPECT_FALSE(IsHighContrastEnabledOnDetailMenu());
@@ -464,8 +482,9 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
CloseDetailMenu();
// Enabling all of the a11y features.
- accessibility::EnableSpokenFeedback(true, NULL, ash::A11Y_NOTIFICATION_NONE);
- accessibility::EnableHighContrast(true);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ true, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableHighContrast(true);
SetMagnifierEnabled(true);
EXPECT_TRUE(CreateDetailedMenu());
EXPECT_TRUE(IsSpokenFeedbackEnabledOnDetailMenu());
@@ -474,8 +493,9 @@ IN_PROC_BROWSER_TEST_F(TrayAccessibilityTest, CheckMarksOnDetailMenu) {
CloseDetailMenu();
// Disabling all of the a11y features.
- accessibility::EnableSpokenFeedback(false, NULL, ash::A11Y_NOTIFICATION_NONE);
- accessibility::EnableHighContrast(false);
+ AccessibilityManager::Get()->EnableSpokenFeedback(
+ false, NULL, ash::A11Y_NOTIFICATION_NONE);
+ AccessibilityManager::Get()->EnableHighContrast(false);
SetMagnifierEnabled(false);
EXPECT_TRUE(CreateDetailedMenu());
EXPECT_FALSE(IsSpokenFeedbackEnabledOnDetailMenu());

Powered by Google App Engine
This is Rietveld 408576698