OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Include test fixture. | 5 // Include test fixture. |
6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); | 6 GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); |
7 | 7 |
8 GEN_INCLUDE(['../../testing/mock_tts.js']); | 8 GEN_INCLUDE(['../../testing/mock_tts.js']); |
9 | 9 |
10 /** | 10 /** |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 <p>start | 64 <p>start |
65 <p>end | 65 <p>end |
66 */}, | 66 */}, |
67 function() { | 67 function() { |
68 cvox.ChromeVox.tts.expectSpeech('start', function() { | 68 cvox.ChromeVox.tts.expectSpeech('start', function() { |
69 global.backgroundObj.onGotCommand('nextLine'); | 69 global.backgroundObj.onGotCommand('nextLine'); |
70 }); | 70 }); |
71 cvox.ChromeVox.tts.expectSpeech('end', testDone); | 71 cvox.ChromeVox.tts.expectSpeech('end', testDone); |
72 }.bind(this)); | 72 }.bind(this)); |
73 }); | 73 }); |
| 74 |
| 75 /** Tests consistency of navigating forward and backward. */ |
| 76 TEST_F('BackgroundTest', 'ForwardBackwardNavigation', function() { |
| 77 this.runWithDocument(function() {/*! |
| 78 <p>start</p> |
| 79 <a href='#a'>alpha</a> |
| 80 <a href='#b'>beta</a> |
| 81 <p> |
| 82 <h1>charlie</h1> |
| 83 <a href='foo'>delta</a> |
| 84 </p> |
| 85 <a href='#bar'>echo</a> |
| 86 <h2>foxtraut</h2> |
| 87 <p>end<span>of test</span></p> |
| 88 */}, |
| 89 function() { |
| 90 var doCmd = function(cmd) { |
| 91 return function() { |
| 92 global.backgroundObj.onGotCommand(cmd); |
| 93 }; |
| 94 }; |
| 95 |
| 96 var expectAfter = |
| 97 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); |
| 98 |
| 99 cvox.ChromeVox.tts.expectSpeech('start'); |
| 100 expectAfter('alpha', doCmd('nextLink')); |
| 101 expectAfter('beta', doCmd('nextLink')); |
| 102 expectAfter('delta', doCmd('nextLink')); |
| 103 expectAfter('beta', doCmd('previousLink')); |
| 104 |
| 105 expectAfter('charlie', doCmd('nextHeading')); |
| 106 expectAfter('foxtraut', doCmd('nextHeading')); |
| 107 expectAfter('charlie', doCmd('previousHeading')); |
| 108 |
| 109 expectAfter('delta', doCmd('nextElement')); |
| 110 expectAfter('echo', doCmd('nextElement')); |
| 111 expectAfter('foxtraut', doCmd('nextElement')); |
| 112 expectAfter('end', doCmd('nextElement')); |
| 113 expectAfter('foxtraut', doCmd('previousElement')); |
| 114 |
| 115 // TODO(dtseng): cleanup these utterances. |
| 116 expectAfter(', end, paragraph, of test, paragraph', doCmd('nextLine')); |
| 117 |
| 118 expectAfter('start', doCmd('goToBeginning')); |
| 119 expectAfter('of test', doCmd('goToEnd')); |
| 120 |
| 121 cvox.ChromeVox.tts.finishExpectations(); |
| 122 }.bind(this)); |
| 123 }); |
OLD | NEW |