Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.extjs

Issue 586103004: Implement ChromeVox next/previous line, link, and heading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Added test (and support). Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/background.extjs
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.extjs
index 207d70732f405a2234804763e1e61a6ed1adc7bb..8d21b34b117f9847e077537432233ac7e24898c8 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.extjs
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.extjs
@@ -67,7 +67,26 @@ MockTts.prototype = {
return this.utterances.some(function(t) {
return t.indexOf(textString) != -1;
});
- }
+ },
+
+ /**
+ * Waits for the given strings to be spoken. If satisfied, |opt_callback| is
+ * called.
+ * @param {!Array.<string>} textStrings
+ * @param {function() : void=} opt_callback
+ */
+ waitForSpeech: function(textStrings, opt_callback) {
+ if (this.checkIfSubstringWasSpoken(textStrings[0])) {
+ textStrings.splice(0, 1);
+ if (textStrings.length == 0) {
+ if (opt_callback)
+ opt_callback();
+ this.utterances.length = 0;
+ return;
+ }
+ }
+ setTimeout(this.waitForSpeech.bind(this, textStrings, opt_callback), 100);
dmazzoni 2014/09/26 06:08:52 Rather than a timeout, could you make a way to reg
+ },
};
/** Tests that ChromeVox classic is in this context. */
@@ -110,3 +129,18 @@ TEST_F('BackgroundTest', 'DesktopFocus', function() {
testButton.focus();
});
});
+
+TEST_F('BackgroundTest', 'InitialFeedback', function() {
+ this.runWithDocument(function() {/*!
+ <p>start
+ <p>end
+ */},
+ function() {
+ cvox.ChromeVox.tts.waitForSpeech(['start'], function() {
+ cvox2.global.backgroundObj.onGotCommand('nextLine');
+ cvox.ChromeVox.tts.waitForSpeech(['end'], function() {
+ testDone();
+ });
+ });
+ }.bind(this));
+});

Powered by Google App Engine
This is Rietveld 408576698