Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs |
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs |
index 74f4125241348e73040e1237b6533d2128054689..c847e03f7f7a1564da19a4d18945267e621bab77 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs |
@@ -71,3 +71,53 @@ TEST_F('BackgroundTest', 'InitialFeedback', function() { |
cvox.ChromeVox.tts.expectSpeech('end', testDone); |
}.bind(this)); |
}); |
+ |
+/** Tests consistency of navigating forward and backward. */ |
+TEST_F('BackgroundTest', 'ForwardBackwardNavigation', function() { |
+ this.runWithDocument(function() {/*! |
+ <p>start</p> |
+ <a href='#a'>alpha</a> |
+ <a href='#b'>beta</a> |
+ <p> |
+ <h1>charlie</h1> |
+ <a href='foo'>delta</a> |
+ </p> |
+ <a href='#bar'>echo</a> |
+ <h2>foxtraut</h2> |
+ <p>end<span>of test</span></p> |
+ */}, |
+ function() { |
+ var doCmd = function(cmd) { |
+ return function() { |
+ global.backgroundObj.onGotCommand(cmd); |
+ }; |
+ }; |
+ |
+ var expectAfter = |
+ cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); |
+ |
+ cvox.ChromeVox.tts.expectSpeech('start'); |
+ expectAfter('alpha', doCmd('nextLink')); |
+ expectAfter('beta', doCmd('nextLink')); |
+ expectAfter('delta', doCmd('nextLink')); |
+ expectAfter('beta', doCmd('previousLink')); |
+ |
+ expectAfter('charlie', doCmd('nextHeading')); |
+ expectAfter('foxtraut', doCmd('nextHeading')); |
+ expectAfter('charlie', doCmd('previousHeading')); |
+ |
+ expectAfter('delta', doCmd('nextElement')); |
+ expectAfter('echo', doCmd('nextElement')); |
+ expectAfter('foxtraut', doCmd('nextElement')); |
+ expectAfter('end', doCmd('nextElement')); |
+ expectAfter('foxtraut', doCmd('previousElement')); |
+ |
+ // TODO(dtseng): cleanup these utterances. |
+ expectAfter(', end, paragraph, of test, paragraph', doCmd('nextLine')); |
+ |
+ expectAfter('start', doCmd('goToBeginning')); |
+ expectAfter('of test', doCmd('goToEnd')); |
+ |
+ cvox.ChromeVox.tts.finishExpectations(); |
+ }.bind(this)); |
+}); |