Commit c5585d4a authored by Katie D's avatar Katie D Committed by Commit Bot

Fix flaky test by not clearing focus ring on mouse down.

Bug: 820373
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I992efd466f5bcb7f20c0b4045be91b9d0f3704c8
Reviewed-on: https://chromium-review.googlesource.com/956699
Commit-Queue: Katie Dektar <katie@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542208}
parent aab0b187
...@@ -202,7 +202,7 @@ SelectToSpeak.prototype = { ...@@ -202,7 +202,7 @@ SelectToSpeak.prototype = {
this.trackingMouse_ = true; this.trackingMouse_ = true;
this.didTrackMouse_ = true; this.didTrackMouse_ = true;
this.mouseStart_ = {x: evt.screenX, y: evt.screenY}; this.mouseStart_ = {x: evt.screenX, y: evt.screenY};
this.cancelIfSpeaking_(); this.cancelIfSpeaking_(false /* don't clear the focus ring */);
// Fire a hit test event on click to warm up the cache. // Fire a hit test event on click to warm up the cache.
this.desktop_.hitTest(evt.screenX, evt.screenY, EventType.MOUSE_PRESSED); this.desktop_.hitTest(evt.screenX, evt.screenY, EventType.MOUSE_PRESSED);
...@@ -345,7 +345,7 @@ SelectToSpeak.prototype = { ...@@ -345,7 +345,7 @@ SelectToSpeak.prototype = {
if (this.isSelectionKeyDown_ && this.keysPressedTogether_.size == 2 && if (this.isSelectionKeyDown_ && this.keysPressedTogether_.size == 2 &&
this.keysPressedTogether_.has(evt.keyCode) && this.keysPressedTogether_.has(evt.keyCode) &&
this.keysPressedTogether_.has(SelectToSpeak.SEARCH_KEY_CODE)) { this.keysPressedTogether_.has(SelectToSpeak.SEARCH_KEY_CODE)) {
this.cancelIfSpeaking_(); this.cancelIfSpeaking_(true /* clear the focus ring */);
chrome.automation.getFocus(this.requestSpeakSelectedText_.bind(this)); chrome.automation.getFocus(this.requestSpeakSelectedText_.bind(this));
} }
this.isSelectionKeyDown_ = false; this.isSelectionKeyDown_ = false;
...@@ -367,7 +367,7 @@ SelectToSpeak.prototype = { ...@@ -367,7 +367,7 @@ SelectToSpeak.prototype = {
this.keysPressedTogether_.has(evt.keyCode) && this.keysPressedTogether_.has(evt.keyCode) &&
this.keysPressedTogether_.size == 1) { this.keysPressedTogether_.size == 1) {
this.trackingMouse_ = false; this.trackingMouse_ = false;
this.cancelIfSpeaking_(); this.cancelIfSpeaking_(true /* clear the focus ring */);
} }
this.keysCurrentlyDown_.delete(evt.keyCode); this.keysCurrentlyDown_.delete(evt.keyCode);
...@@ -750,7 +750,7 @@ SelectToSpeak.prototype = { ...@@ -750,7 +750,7 @@ SelectToSpeak.prototype = {
* Prepares for speech. Call once before chrome.tts.speak is called. * Prepares for speech. Call once before chrome.tts.speak is called.
*/ */
prepareForSpeech_: function() { prepareForSpeech_: function() {
this.cancelIfSpeaking_(); this.cancelIfSpeaking_(true /* clear the focus ring */);
if (this.intervalRef_ !== undefined) { if (this.intervalRef_ !== undefined) {
clearInterval(this.intervalRef_); clearInterval(this.intervalRef_);
} }
...@@ -798,10 +798,17 @@ SelectToSpeak.prototype = { ...@@ -798,10 +798,17 @@ SelectToSpeak.prototype = {
* record a cancel event if speech was in progress. We must cancel * record a cancel event if speech was in progress. We must cancel
* before the callback (rather than in it) to avoid race conditions * before the callback (rather than in it) to avoid race conditions
* where cancel is called twice. * where cancel is called twice.
* @param {boolean} clearFocusRing Whether to clear the focus ring
* as well.
*/ */
cancelIfSpeaking_: function() { cancelIfSpeaking_: function(clearFocusRing) {
chrome.tts.isSpeaking(this.recordCancelIfSpeaking_.bind(this)); chrome.tts.isSpeaking(this.recordCancelIfSpeaking_.bind(this));
this.stopAll_(); if (clearFocusRing) {
this.stopAll_();
} else {
// Just stop speech
chrome.tts.stop();
}
}, },
/** /**
......
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