Commit 50af1016 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Ensure empty strings in Output do not reset queueMode

Change-Id: Ic0a737a7dc4663761f8596a82a3675b52bdfa48d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096913
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarAkihiro Ota <akihiroota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749475}
parent b43b040e
......@@ -2483,3 +2483,20 @@ TEST_F('ChromeVoxBackgroundTest', 'ReadWindowTitle', function() {
.replay();
});
});
TEST_F('ChromeVoxBackgroundTest', 'OutputEmptyQueueMode', function() {
const mockFeedback = this.createMockFeedback();
this.runWithLoadedTree('<p>unused</p>', function(root) {
const output = new Output();
Output.forceModeForNextSpeechUtterance(QueueMode.CATEGORY_FLUSH);
output.append_(
output.speechBuffer_, new Spannable(''),
{annotation: [new Output.Action()]});
output.withString('test');
mockFeedback.clearPendingOutput()
.call(output.go.bind(output))
.expectSpeechWithQueueMode('', QueueMode.CATEGORY_FLUSH)
.expectSpeechWithQueueMode('test', QueueMode.CATEGORY_FLUSH)
.replay();
});
});
......@@ -515,7 +515,13 @@ Output = class {
}
ChromeVox.tts.speak(buff.toString(), queueMode, speechProps);
queueMode = QueueMode.QUEUE;
// Skip resetting |queueMode| if the |text| is empty. If we don't do this,
// and the tts engine doesn't generate a callback, we might not properly
// flush.
if (text !== '') {
queueMode = QueueMode.QUEUE;
}
}
if (this.speechRulesStr_.str) {
LogStore.getInstance().writeTextLog(
......
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