| 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 /** |
| 11 * Test fixture for Background. | 11 * Test fixture for Background. |
| 12 * @constructor | 12 * @constructor |
| 13 * @extends {ChromeVoxNextE2ETest} | 13 * @extends {ChromeVoxNextE2ETest} |
| 14 */ | 14 */ |
| 15 function BackgroundTest() {} | 15 function BackgroundTest() { |
| 16 ChromeVoxNextE2ETest.call(this); |
| 17 } |
| 16 | 18 |
| 17 BackgroundTest.prototype = { | 19 BackgroundTest.prototype = { |
| 18 __proto__: ChromeVoxNextE2ETest.prototype, | 20 __proto__: ChromeVoxNextE2ETest.prototype, |
| 19 | 21 |
| 20 /** @override */ | 22 /** @override */ |
| 21 setUp: function() { | 23 setUp: function() { |
| 22 this.mockTts = new MockTts(); | 24 this.mockTts = new MockTts(); |
| 23 cvox.ChromeVox.tts = this.mockTts; | 25 cvox.ChromeVox.tts = this.mockTts; |
| 24 }, | 26 }, |
| 25 | 27 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return root; | 78 return root; |
| 77 } | 79 } |
| 78 for (var i = 0; i < root.children.length; i++) { | 80 for (var i = 0; i < root.children.length; i++) { |
| 79 var found = findStatusTray(root.children[i]); | 81 var found = findStatusTray(root.children[i]); |
| 80 if (found) | 82 if (found) |
| 81 return found; | 83 return found; |
| 82 } | 84 } |
| 83 return null; | 85 return null; |
| 84 } | 86 } |
| 85 | 87 |
| 86 chrome.automation.getDesktop(function(root) { | 88 chrome.automation.getDesktop(this.newCallback(function(root) { |
| 87 var testButton = findStatusTray(root); | 89 var testButton = findStatusTray(root); |
| 88 cvox.ChromeVox.tts.expectSpeech('Status tray', testDone); | 90 cvox.ChromeVox.tts.expectSpeech('Status tray', this.newCallback()); |
| 89 testButton.focus(); | 91 testButton.focus(); |
| 90 }); | 92 })); |
| 91 }); | 93 }); |
| 92 | 94 |
| 93 /** Tests feedback once a page loads. */ | 95 /** Tests feedback once a page loads. */ |
| 94 TEST_F('BackgroundTest', 'MANUAL_InitialFeedback', function() { | 96 TEST_F('BackgroundTest', 'MANUAL_InitialFeedback', function() { |
| 95 cvox.ChromeVox.tts.expectSpeech('start', testDone); | 97 cvox.ChromeVox.tts.expectSpeech('start', this.newCallback()); |
| 96 | 98 |
| 97 this.runWithTab(function() {/*! | 99 this.runWithTab(function() {/*! |
| 98 <p>start | 100 <p>start |
| 99 <p>end | 101 <p>end |
| 100 */}); | 102 */}); |
| 101 }); | 103 }); |
| 102 | 104 |
| 103 /** Tests consistency of navigating forward and backward. */ | 105 /** Tests consistency of navigating forward and backward. */ |
| 104 TEST_F('BackgroundTest', 'MANUAL_ForwardBackwardNavigation', function() { | 106 TEST_F('BackgroundTest', 'MANUAL_ForwardBackwardNavigation', function() { |
| 105 this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { | 107 this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { |
| 106 var doCmd = this.doCmd.bind(this); | 108 var doCmd = this.doCmd.bind(this); |
| 107 var expectAfter = | 109 var expectAfter = |
| 108 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); | 110 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); |
| 109 | 111 |
| 110 expectAfter('alpha', doCmd('nextLink')); | 112 expectAfter('alpha', doCmd('nextLink')); |
| 111 expectAfter('beta', doCmd('nextLink')); | 113 expectAfter('beta', doCmd('nextLink')); |
| 112 expectAfter('delta', doCmd('nextLink')); | 114 expectAfter('delta', doCmd('nextLink')); |
| 113 expectAfter('beta', doCmd('previousLink')); | 115 expectAfter('beta', doCmd('previousLink')); |
| 114 | 116 |
| 115 expectAfter('charlie', doCmd('nextHeading')); | 117 expectAfter('charlie', doCmd('nextHeading')); |
| 116 expectAfter('foxtraut', doCmd('nextHeading')); | 118 expectAfter('foxtraut', doCmd('nextHeading')); |
| 117 expectAfter('charlie', doCmd('previousHeading')); | 119 expectAfter('charlie', doCmd('previousHeading')); |
| 118 | 120 |
| 119 expectAfter('delta', doCmd('nextElement')); | 121 expectAfter('delta', doCmd('nextElement')); |
| 120 expectAfter('echo', doCmd('nextElement')); | 122 expectAfter('echo', doCmd('nextElement')); |
| 121 expectAfter('foxtraut', doCmd('nextElement')); | 123 expectAfter('foxtraut', doCmd('nextElement')); |
| 122 expectAfter('end', doCmd('nextElement')); | 124 expectAfter('end', doCmd('nextElement')); |
| 123 expectAfter('foxtraut', doCmd('previousElement')); | 125 expectAfter('foxtraut', doCmd('previousElement')); |
| 124 expectAfter('end of test', doCmd('nextLine')); | 126 expectAfter('end of test', doCmd('nextLine')); |
| 125 | 127 |
| 126 expectAfter('start', doCmd('goToBeginning')); | 128 expectAfter('start', doCmd('goToBeginning')); |
| 127 expectAfter('of test', doCmd('goToEnd')); | 129 expectAfter('of test', doCmd('goToEnd')); |
| 128 | 130 |
| 129 cvox.ChromeVox.tts.finishExpectations(); | 131 cvox.ChromeVox.tts.finishExpectations(this.newCallback()); |
| 130 }.bind(this) | 132 }); |
| 131 ); | |
| 132 }); | 133 }); |
| 133 | 134 |
| 134 TEST_F('BackgroundTest', 'MANUAL_CaretNavigation', function() { | 135 TEST_F('BackgroundTest', 'MANUAL_CaretNavigation', function() { |
| 135 this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { | 136 this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { |
| 136 var doCmd = this.doCmd.bind(this); | 137 var doCmd = this.doCmd.bind(this); |
| 137 var expectAfter = | 138 var expectAfter = |
| 138 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); | 139 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); |
| 139 | 140 |
| 140 expectAfter('t', doCmd('nextCharacter'), true); | 141 expectAfter('t', doCmd('nextCharacter'), true); |
| 141 expectAfter('a', doCmd('nextCharacter'), true); | 142 expectAfter('a', doCmd('nextCharacter'), true); |
| 142 expectAfter('Link alpha', doCmd('nextWord'), true); | 143 expectAfter('Link alpha', doCmd('nextWord'), true); |
| 143 expectAfter('Link beta', doCmd('nextWord'), true); | 144 expectAfter('Link beta', doCmd('nextWord'), true); |
| 144 expectAfter('Heading charlie', doCmd('nextWord'), true); | 145 expectAfter('Heading charlie', doCmd('nextWord'), true); |
| 145 expectAfter('Link delta', doCmd('nextLine'), true); | 146 expectAfter('Link delta', doCmd('nextLine'), true); |
| 146 expectAfter('Link echo', doCmd('nextLine'), true); | 147 expectAfter('Link echo', doCmd('nextLine'), true); |
| 147 expectAfter('Heading foxtraut', doCmd('nextLine'), true); | 148 expectAfter('Heading foxtraut', doCmd('nextLine'), true); |
| 148 expectAfter( | 149 expectAfter( |
| 149 'end of test', doCmd('nextLine'), true); | 150 'end of test', doCmd('nextLine'), true); |
| 150 expectAfter('n', doCmd('nextCharacter'), true); | 151 expectAfter('n', doCmd('nextCharacter'), true); |
| 151 expectAfter('e', doCmd('previousCharacter'), true); | 152 expectAfter('e', doCmd('previousCharacter'), true); |
| 152 expectAfter('Heading t', doCmd('previousCharacter'), true); | 153 expectAfter('Heading t', doCmd('previousCharacter'), true); |
| 153 expectAfter('foxtraut', doCmd('previousWord'), true); | 154 expectAfter('foxtraut', doCmd('previousWord'), true); |
| 154 expectAfter('Link echo', doCmd('previousWord'), true); | 155 expectAfter('Link echo', doCmd('previousWord'), true); |
| 155 expectAfter('Link a', doCmd('previousCharacter'), true); | 156 expectAfter('Link a', doCmd('previousCharacter'), true); |
| 156 expectAfter('t', doCmd('previousCharacter'), true); | 157 expectAfter('t', doCmd('previousCharacter'), true); |
| 157 expectAfter('Link echo', doCmd('nextWord'), true); | 158 expectAfter('Link echo', doCmd('nextWord'), true); |
| 158 | 159 |
| 159 cvox.ChromeVox.tts.finishExpectations(); | 160 cvox.ChromeVox.tts.finishExpectations(this.newCallback()); |
| 160 }.bind(this)); | 161 }); |
| 161 }); | 162 }); |
| 162 | 163 |
| 163 // Flaky: http://crbug.com/451362 | 164 // Flaky: http://crbug.com/451362 |
| 164 TEST_F('BackgroundTest', 'DISABLED_SelectSingleBasic', function() { | 165 TEST_F('BackgroundTest', 'DISABLED_SelectSingleBasic', function() { |
| 165 this.runWithLoadedTree(this.formsDoc, function(tabId) { | 166 this.runWithLoadedTree(this.formsDoc, function() { |
| 166 var sendDownToSelect = | 167 var sendDownToSelect = |
| 167 this.sendKeyToElement.bind(this, tabId, 'Down', '#fruitSelect'); | 168 this.sendKeyToElement.bind(this, undefined, 'Down', '#fruitSelect'); |
| 168 var expect = cvox.ChromeVox.tts.expectSpeech.bind(cvox.ChromeVox.tts); | 169 var expect = cvox.ChromeVox.tts.expectSpeech.bind(cvox.ChromeVox.tts); |
| 169 expect('apple Menu item 1 of 3 ', sendDownToSelect, true); | 170 expect('apple Menu item 1 of 3 ', sendDownToSelect, true); |
| 170 expect('grape 2 of 3 ', sendDownToSelect, true); | 171 expect('grape 2 of 3 ', sendDownToSelect, true); |
| 171 expect('banana 3 of 3 ', testDone, true); | 172 expect('banana 3 of 3 ', function() {}, true); |
| 172 cvox.ChromeVox.tts.finishExpectations(); | 173 cvox.ChromeVox.tts.finishExpectations(this.newCallback()); |
| 173 }.bind(this)); | 174 }); |
| 174 }); | 175 }); |
| 175 | 176 |
| 176 TEST_F('BackgroundTest', 'MANUAL_ContinuousRead', function() { | 177 TEST_F('BackgroundTest', 'MANUAL_ContinuousRead', function() { |
| 177 this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { | 178 this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { |
| 178 cvox.ChromeVox.tts.expectSpeech('start'); | 179 cvox.ChromeVox.tts.expectSpeech('start'); |
| 179 cvox.ChromeVox.tts.expectSpeechAfter('start', this.doCmd('continuousRead')); | 180 cvox.ChromeVox.tts.expectSpeechAfter('start', this.doCmd('continuousRead')); |
| 180 cvox.ChromeVox.tts.expectSpeech('alpha Link'); | 181 cvox.ChromeVox.tts.expectSpeech('alpha Link'); |
| 181 cvox.ChromeVox.tts.expectSpeech('beta Link'); | 182 cvox.ChromeVox.tts.expectSpeech('beta Link'); |
| 182 cvox.ChromeVox.tts.expectSpeech('Heading charlie', testDone); | 183 cvox.ChromeVox.tts.expectSpeech('Heading charlie', function() {}); |
| 183 cvox.ChromeVox.tts.finishExpectations(); | 184 cvox.ChromeVox.tts.finishExpectations(this.newCallback()); |
| 184 }.bind(this)); | 185 }); |
| 185 }); | 186 }); |
| OLD | NEW |