Commit 4b74e9c1 authored by Hiroki Sato's avatar Hiroki Sato Committed by Commit Bot

Expose DockedMagnifier preference via chromeosInfoPrivate API.

This change exposes the docked magnifier preferences via extension API.

Bug: 1125420
Test: browser_test ChromeOSInfoPrivateTest
Change-Id: Id38a8a486e8c082e8f5d7973332f1fb8f26673d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2409072Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Hiroki Sato <hirokisato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815031}
parent f90fe010
...@@ -116,6 +116,9 @@ const char kPropertySwitchAccessEnabled[] = "a11ySwitchAccessEnabled"; ...@@ -116,6 +116,9 @@ const char kPropertySwitchAccessEnabled[] = "a11ySwitchAccessEnabled";
// Key which corresponds to the cursor color A11Y property in JS. // Key which corresponds to the cursor color A11Y property in JS.
const char kPropertyCursorColorEnabled[] = "a11yCursorColorEnabled"; const char kPropertyCursorColorEnabled[] = "a11yCursorColorEnabled";
// Key which corresponds to the docked magnifier property in JS.
const char kPropertyDockedMagnifierEnabled[] = "a11yDockedMagnifierEnabled";
// Key which corresponds to the send-function-keys property in JS. // Key which corresponds to the send-function-keys property in JS.
const char kPropertySendFunctionsKeys[] = "sendFunctionKeys"; const char kPropertySendFunctionsKeys[] = "sendFunctionKeys";
...@@ -225,6 +228,7 @@ const struct { ...@@ -225,6 +228,7 @@ const struct {
{kPropertySwitchAccessEnabled, {kPropertySwitchAccessEnabled,
ash::prefs::kAccessibilitySwitchAccessEnabled}, ash::prefs::kAccessibilitySwitchAccessEnabled},
{kPropertyCursorColorEnabled, ash::prefs::kAccessibilityCursorColorEnabled}, {kPropertyCursorColorEnabled, ash::prefs::kAccessibilityCursorColorEnabled},
{kPropertyDockedMagnifierEnabled, ash::prefs::kDockedMagnifierEnabled},
{kPropertySendFunctionsKeys, prefs::kLanguageSendFunctionKeys}}; {kPropertySendFunctionsKeys, prefs::kLanguageSendFunctionKeys}};
const char* GetBoolPrefNameForApiProperty(const char* api_name) { const char* GetBoolPrefNameForApiProperty(const char* api_name) {
......
...@@ -66,13 +66,11 @@ IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) { ...@@ -66,13 +66,11 @@ IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) {
prefs->GetBoolean(ash::prefs::kAccessibilitySpokenFeedbackEnabled)); prefs->GetBoolean(ash::prefs::kAccessibilitySpokenFeedbackEnabled));
ASSERT_FALSE( ASSERT_FALSE(
prefs->GetBoolean(ash::prefs::kAccessibilityHighContrastEnabled)); prefs->GetBoolean(ash::prefs::kAccessibilityHighContrastEnabled));
ASSERT_FALSE(
prefs->GetBoolean(ash::prefs::kAccessibilityScreenMagnifierEnabled));
ASSERT_FALSE(prefs->GetBoolean(ash::prefs::kAccessibilityAutoclickEnabled)); ASSERT_FALSE(prefs->GetBoolean(ash::prefs::kAccessibilityAutoclickEnabled));
ASSERT_FALSE(prefs->GetBoolean(ash::prefs::kAccessibilityCursorColorEnabled)); ASSERT_FALSE(prefs->GetBoolean(ash::prefs::kAccessibilityCursorColorEnabled));
ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( ASSERT_FALSE(
prefs::kLanguageSendFunctionKeys)); profile()->GetPrefs()->GetBoolean(prefs::kLanguageSendFunctionKeys));
ASSERT_TRUE(RunComponentExtensionTest("chromeos_info_private/basic")) ASSERT_TRUE(RunComponentExtensionTest("chromeos_info_private/basic"))
<< message_; << message_;
...@@ -83,14 +81,39 @@ IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) { ...@@ -83,14 +81,39 @@ IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSet) {
ASSERT_TRUE( ASSERT_TRUE(
prefs->GetBoolean(ash::prefs::kAccessibilitySpokenFeedbackEnabled)); prefs->GetBoolean(ash::prefs::kAccessibilitySpokenFeedbackEnabled));
ASSERT_TRUE(prefs->GetBoolean(ash::prefs::kAccessibilityHighContrastEnabled)); ASSERT_TRUE(prefs->GetBoolean(ash::prefs::kAccessibilityHighContrastEnabled));
ASSERT_TRUE(
prefs->GetBoolean(ash::prefs::kAccessibilityScreenMagnifierEnabled));
ASSERT_TRUE(prefs->GetBoolean(ash::prefs::kAccessibilityAutoclickEnabled)); ASSERT_TRUE(prefs->GetBoolean(ash::prefs::kAccessibilityAutoclickEnabled));
ASSERT_TRUE(prefs->GetBoolean(ash::prefs::kAccessibilityCursorColorEnabled)); ASSERT_TRUE(prefs->GetBoolean(ash::prefs::kAccessibilityCursorColorEnabled));
ASSERT_TRUE(prefs->GetBoolean(prefs::kLanguageSendFunctionKeys)); ASSERT_TRUE(prefs->GetBoolean(prefs::kLanguageSendFunctionKeys));
} }
// docked magnifier and screen magnifier are mutually exclusive. test each of
// them one by one.
IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSetDockedMagnifier) {
PrefService* prefs = profile()->GetPrefs();
ASSERT_FALSE(prefs->GetBoolean(ash::prefs::kDockedMagnifierEnabled));
ASSERT_TRUE(RunComponentExtensionTestWithArg("chromeos_info_private/basic",
"dockedMagnifier"))
<< message_;
ASSERT_TRUE(prefs->GetBoolean(ash::prefs::kDockedMagnifierEnabled));
}
IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, TestGetAndSetScreenMagnifier) {
PrefService* prefs = profile()->GetPrefs();
ASSERT_FALSE(
prefs->GetBoolean(ash::prefs::kAccessibilityScreenMagnifierEnabled));
ASSERT_TRUE(RunComponentExtensionTestWithArg("chromeos_info_private/basic",
"screenMagnifier"))
<< message_;
ASSERT_TRUE(
prefs->GetBoolean(ash::prefs::kAccessibilityScreenMagnifierEnabled));
}
// TODO(steel): Investigate merging the following tests. // TODO(steel): Investigate merging the following tests.
IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Kiosk) { IN_PROC_BROWSER_TEST_F(ChromeOSInfoPrivateTest, Kiosk) {
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
"a11ySelectToSpeakEnabled", "a11ySelectToSpeakEnabled",
"a11ySwitchAccessEnabled", "a11ySwitchAccessEnabled",
"a11yCursorColorEnabled", "a11yCursorColorEnabled",
"a11yDockedMagnifierEnabled",
"sendFunctionKeys"], "sendFunctionKeys"],
"description": "Chrome OS system property name" "description": "Chrome OS system property name"
}, },
...@@ -115,6 +116,7 @@ ...@@ -115,6 +116,7 @@
"a11ySelectToSpeakEnabled" : {"type": "boolean", "optional": true, "description": "If true, select to speak will be enabled."}, "a11ySelectToSpeakEnabled" : {"type": "boolean", "optional": true, "description": "If true, select to speak will be enabled."},
"a11ySwitchAccessEnabled" : {"type": "boolean", "optional": true, "description": "If true, switch access will be enabled."}, "a11ySwitchAccessEnabled" : {"type": "boolean", "optional": true, "description": "If true, switch access will be enabled."},
"a11yCursorColorEnabled" : {"type": "boolean", "optional": true, "description": "If true, colorized cursor will be enabled."}, "a11yCursorColorEnabled" : {"type": "boolean", "optional": true, "description": "If true, colorized cursor will be enabled."},
"a11yDockedMagnifierEnabled" : {"type": "boolean", "optional": true, "description": "If true, docked magnifier will be enabled."},
"sendFunctionKeys" : {"type": "boolean", "optional": true, "description": "If true, the ChromeOS top row keys send function keys."}, "sendFunctionKeys" : {"type": "boolean", "optional": true, "description": "If true, the ChromeOS top row keys send function keys."},
"supportedTimezones" : { "supportedTimezones" : {
"type": "array", "type": "array",
......
...@@ -79,81 +79,70 @@ function timezoneSetTest() { ...@@ -79,81 +79,70 @@ function timezoneSetTest() {
)); ));
} }
function prefsTest() { function prefsTest(prefs) {
chrome.chromeosInfoPrivate.set('a11yLargeCursorEnabled', true); for (const pref of prefs) {
chrome.chromeosInfoPrivate.set('a11yStickyKeysEnabled', true); chrome.chromeosInfoPrivate.set(pref, true);
chrome.chromeosInfoPrivate.set('a11ySpokenFeedbackEnabled', true); }
chrome.chromeosInfoPrivate.set('a11yHighContrastEnabled', true); chrome.chromeosInfoPrivate.get(prefs, pass(function(values) {
chrome.chromeosInfoPrivate.set('a11yScreenMagnifierEnabled', true); for (const pref of prefs) {
chrome.chromeosInfoPrivate.set('a11yAutoClickEnabled', true); chrome.test.assertEq(values[pref], true);
chrome.chromeosInfoPrivate.set('a11yVirtualKeyboardEnabled', true); }
chrome.chromeosInfoPrivate.set('a11yCaretHighlightEnabled', true); }));
chrome.chromeosInfoPrivate.set('a11yCursorHighlightEnabled', true);
chrome.chromeosInfoPrivate.set('a11yFocusHighlightEnabled', true);
chrome.chromeosInfoPrivate.set('a11ySelectToSpeakEnabled', true);
chrome.chromeosInfoPrivate.set('a11ySwitchAccessEnabled', true);
chrome.chromeosInfoPrivate.set('a11yCursorColorEnabled', true);
chrome.chromeosInfoPrivate.set('sendFunctionKeys', true);
chrome.chromeosInfoPrivate.get(
['a11yLargeCursorEnabled',
'a11yStickyKeysEnabled',
'a11ySpokenFeedbackEnabled',
'a11yHighContrastEnabled',
'a11yScreenMagnifierEnabled',
'a11yAutoClickEnabled',
'a11yVirtualKeyboardEnabled',
'a11yCaretHighlightEnabled',
'a11yCursorHighlightEnabled',
'a11yFocusHighlightEnabled',
'a11ySelectToSpeakEnabled',
'a11ySwitchAccessEnabled',
'a11yCursorColorEnabled',
'sendFunctionKeys'],
pass(
function(values) {
chrome.test.assertEq(values['a11yLargeCursorEnabled'], true);
chrome.test.assertEq(values['a11yStickyKeysEnabled'], true);
chrome.test.assertEq(values['a11ySpokenFeedbackEnabled'], true);
chrome.test.assertEq(values['a11yHighContrastEnabled'], true);
chrome.test.assertEq(values['a11yScreenMagnifierEnabled'], true);
chrome.test.assertEq(values['a11yAutoClickEnabled'], true);
chrome.test.assertEq(values['a11yVirtualKeyboardEnabled'], true);
chrome.test.assertEq(values['a11yCaretHighlightEnabled'], true);
chrome.test.assertEq(values['a11yCursorHighlightEnabled'], true);
chrome.test.assertEq(values['a11yFocusHighlightEnabled'], true);
chrome.test.assertEq(values['a11ySelectToSpeakEnabled'], true);
chrome.test.assertEq(values['a11ySwitchAccessEnabled'], true);
chrome.test.assertEq(values['a11yCursorColorEnabled'], true);
chrome.test.assertEq(values['sendFunctionKeys'], true);
}
));
} }
// Run generated chrome.chromeosInfoPrivate.get() tests. chrome.test.getConfig(function(config) {
var tests = generateTestsForKeys(['hwid', var tests = [];
'customizationId', switch (config.customArg) {
'homeProvider', case 'dockedMagnifier':
'initialLocale', tests.push(() => prefsTest(['a11yDockedMagnifierEnabled']));
'board', break;
'isOwner', case 'screenMagnifier':
'sessionType', tests.push(() => prefsTest(['a11yScreenMagnifierEnabled']));
'playStoreStatus', break;
'managedDeviceStatus', default:
'clientId', // Generated chrome.chromeosInfoPrivate.get() tests.
'a11yLargeCursorEnabled', tests = generateTestsForKeys([
'a11yStickyKeysEnabled', 'hwid',
'a11ySpokenFeedbackEnabled', 'customizationId',
'a11yHighContrastEnabled', 'homeProvider',
'a11yScreenMagnifierEnabled', 'initialLocale',
'a11yAutoClickEnabled', 'board',
'a11yVirtualKeyboardEnabled', 'isOwner',
'a11yCursorColorEnabled', 'sessionType',
'sendFunctionKeys', 'playStoreStatus',
'timezone', 'managedDeviceStatus',
'supportedTimezones']) 'clientId',
'a11yLargeCursorEnabled',
// Add chrome.chromeosInfoPrivate.set() test. 'a11yStickyKeysEnabled',
tests.push(timezoneSetTest); 'a11ySpokenFeedbackEnabled',
tests.push(prefsTest); 'a11yHighContrastEnabled',
'a11yScreenMagnifierEnabled',
'a11yAutoClickEnabled',
'a11yVirtualKeyboardEnabled',
'a11yCaretHighlightEnabled',
'a11yCursorColorEnabled',
'a11yFocusHighlightEnabled',
'a11ySelectToSpeakEnabled',
'a11yCursorColorEnabled',
'a11ySwitchAccessEnabled',
'a11yDockedMagnifierEnabled',
'sendFunctionKeys',
'timezone',
'supportedTimezones'
]);
chrome.test.runTests(tests); // Add chrome.chromeosInfoPrivate.set() test.
tests.push(timezoneSetTest);
tests.push(() => prefsTest([
'a11yLargeCursorEnabled', 'a11yStickyKeysEnabled',
'a11ySpokenFeedbackEnabled', 'a11yHighContrastEnabled',
'a11yAutoClickEnabled', 'a11yVirtualKeyboardEnabled',
'a11yCaretHighlightEnabled', 'a11yCursorHighlightEnabled',
'a11yFocusHighlightEnabled', 'a11ySelectToSpeakEnabled',
'a11ySwitchAccessEnabled', 'a11yCursorColorEnabled',
'sendFunctionKeys'
]));
break;
}
chrome.test.runTests(tests);
});
...@@ -32,6 +32,7 @@ chrome.chromeosInfoPrivate.PropertyName = { ...@@ -32,6 +32,7 @@ chrome.chromeosInfoPrivate.PropertyName = {
A11Y_SELECT_TO_SPEAK_ENABLED: 'a11ySelectToSpeakEnabled', A11Y_SELECT_TO_SPEAK_ENABLED: 'a11ySelectToSpeakEnabled',
A11Y_SWITCH_ACCESS_ENABLED: 'a11ySwitchAccessEnabled', A11Y_SWITCH_ACCESS_ENABLED: 'a11ySwitchAccessEnabled',
A11Y_CURSOR_COLOR_ENABLED: 'a11yCursorColorEnabled', A11Y_CURSOR_COLOR_ENABLED: 'a11yCursorColorEnabled',
A11Y_DOCKED_MAGNIFIER_ENABLED: 'a11yDockedMagnifierEnabled',
SEND_FUNCTION_KEYS: 'sendFunctionKeys', SEND_FUNCTION_KEYS: 'sendFunctionKeys',
}; };
...@@ -121,6 +122,7 @@ chrome.chromeosInfoPrivate.AssistantStatus = { ...@@ -121,6 +122,7 @@ chrome.chromeosInfoPrivate.AssistantStatus = {
* a11ySelectToSpeakEnabled: (boolean|undefined), * a11ySelectToSpeakEnabled: (boolean|undefined),
* a11ySwitchAccessEnabled: (boolean|undefined), * a11ySwitchAccessEnabled: (boolean|undefined),
* a11yCursorColorEnabled: (boolean|undefined), * a11yCursorColorEnabled: (boolean|undefined),
* a11yDockedMagnifierEnabled: (boolean|undefined),
* sendFunctionKeys: (boolean|undefined), * sendFunctionKeys: (boolean|undefined),
* supportedTimezones: (!Array<!Array<string>>|undefined) * supportedTimezones: (!Array<!Array<string>>|undefined)
* }): void} callback * }): void} callback
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment