Fix race condition where speech was canceled after starting.
This occured when a user used seach+s to start speech while speech was already in progress. The change makes sure that chrome.tts.stop is called before the 'isSpeaking' callback is fired, to make sure that it doesn't get called late. This may cause a few cancel events to not be logged if the tts engine responds very quickly, but based on some manual testing it appears that events should be fine because the tts engine has some latency. I'm not sure how to write tests for this because it requires a lot of timing and a real TTS engine. Open to suggestions. Works well based on local testing, repeatedly using search+s and search+mouse to to cancel and restart speech. Bug: 819926 Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation Change-Id: I9b59caa4d69be1c0a8ae14af6c850113ff140360 Reviewed-on: https://chromium-review.googlesource.com/956226Reviewed-by:David Tseng <dtseng@chromium.org> Commit-Queue: Katie Dektar <katie@chromium.org> Cr-Commit-Position: refs/heads/master@{#541943}
Showing
Please register or sign in to comment