Commit b67a109d authored by Joel Riley's avatar Joel Riley Committed by Chromium LUCI CQ

Retain reading speed across Select-to-speak sessions

This came up in our team's testing, that it is confusing that the user's reading speed isn't remembered if they activate STS on different Chrome tabs for instance. If STS is hard reset (deactivating feature or reboot), its ok to restore system default speech rate.

AX-Relnotes: Select-to-speak will now retain user selected reading speed across sessions, unless Select-to-speak is deactivated or otherwise hard restarts (from reboot, restart, etc).

Bug: 1165823
Change-Id: Ia2e456fac2854133714e41c5341cde0ace54ecbf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2623839Reviewed-by: default avatarKatie Dektar <katie@chromium.org>
Commit-Queue: Joel Riley <joelriley@google.com>
Cr-Commit-Position: refs/heads/master@{#842659}
parent 81d62c8b
...@@ -736,7 +736,6 @@ export class SelectToSpeak { ...@@ -736,7 +736,6 @@ export class SelectToSpeak {
stopAll_() { stopAll_() {
chrome.tts.stop(); chrome.tts.stop();
this.clearFocusRing_(); this.clearFocusRing_();
this.overrideSpeechRate_ = null; // Reset speech rate to system default
this.onStateChanged_(SelectToSpeakState.INACTIVE); this.onStateChanged_(SelectToSpeakState.INACTIVE);
} }
......
...@@ -481,7 +481,6 @@ TEST_F( ...@@ -481,7 +481,6 @@ TEST_F(
}); });
}); });
// TODO(https://crbug.com/1157817): Fix Flaky Test.
TEST_F( TEST_F(
'SelectToSpeakNavigationControlTest', 'ChangeSpeedWhilePlaying', 'SelectToSpeakNavigationControlTest', 'ChangeSpeedWhilePlaying',
function() { function() {
...@@ -524,6 +523,31 @@ TEST_F( ...@@ -524,6 +523,31 @@ TEST_F(
}); });
}); });
TEST_F('SelectToSpeakNavigationControlTest', 'RetainsSpeedChange', function() {
chrome.settingsPrivate.setPref('settings.tts.speech_rate', 1.2);
const bodyHtml = `
<p id="p1">Paragraph 1</p>'
`;
this.runWithLoadedTree(
this.generateHtmlWithSelectedElement('p1', bodyHtml), () => {
this.triggerReadSelectedText();
// Changing speed then exit.
selectToSpeak.onSelectToSpeakPanelAction_(
chrome.accessibilityPrivate.SelectToSpeakPanelAction.CHANGE_SPEED,
1.5);
selectToSpeak.onSelectToSpeakPanelAction_(
chrome.accessibilityPrivate.SelectToSpeakPanelAction.EXIT);
assertFalse(this.mockTts.currentlySpeaking());
assertEquals(this.mockTts.pendingUtterances().length, 0);
// Next TTS session should remember previous rate.
this.triggerReadSelectedText();
assertTrue(this.mockTts.currentlySpeaking());
assertEquals(this.mockTts.getOptions().rate, 1.5);
});
});
TEST_F( TEST_F(
'SelectToSpeakNavigationControlTest', 'ChangeSpeedWhilePaused', function() { 'SelectToSpeakNavigationControlTest', 'ChangeSpeedWhilePaused', function() {
chrome.settingsPrivate.setPref('settings.tts.speech_rate', 1.2); chrome.settingsPrivate.setPref('settings.tts.speech_rate', 1.2);
......
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