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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs

Issue 880063002: Ensure WebView notifies desktop automation on creation, destruction, and change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wait for start. Created 5 years, 10 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 unified diff | Download patch
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 }); 90 });
91 }); 91 });
92 92
93 /** Tests feedback once a page loads. */ 93 /** Tests feedback once a page loads. */
94 TEST_F('BackgroundTest', 'InitialFeedback', function() { 94 TEST_F('BackgroundTest', 'InitialFeedback', function() {
95 cvox.ChromeVox.tts.expectSpeech('start', function() { 95 cvox.ChromeVox.tts.expectSpeech('start', function() {
96 global.backgroundObj.onGotCommand('nextLine'); 96 global.backgroundObj.onGotCommand('nextLine');
97 }, true); 97 }, true);
98 cvox.ChromeVox.tts.expectSpeech('end', testDone, true); 98 cvox.ChromeVox.tts.expectSpeech('end', testDone, true);
99 99
100 this.runWithDocument(function() {/*! 100 this.runWithAutomation(function() {/*!
101 <p>start 101 <p>start
102 <p>end 102 <p>end
103 */}, 103 */},
104 function() {}); 104 function() {});
105 }); 105 });
106 106
107 /** Tests consistency of navigating forward and backward. */ 107 /** Tests consistency of navigating forward and backward. */
108 TEST_F('BackgroundTest', 'ForwardBackwardNavigation', function() { 108 TEST_F('BackgroundTest', 'ForwardBackwardNavigation', function() {
109 cvox.ChromeVox.tts.expectSpeech('start', null, true); 109 this.runWithAutomation(this.linksAndHeadingsDoc, function() {
110 this.runWithDocument(this.linksAndHeadingsDoc, function() {
111 var doCmd = this.doCmd.bind(this); 110 var doCmd = this.doCmd.bind(this);
112 var expectAfter = 111 var expectAfter =
113 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); 112 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts);
114 113
115 expectAfter('alpha', doCmd('nextLink')); 114 expectAfter('alpha', doCmd('nextLink'));
116 expectAfter('beta', doCmd('nextLink')); 115 expectAfter('beta', doCmd('nextLink'));
117 expectAfter('delta', doCmd('nextLink')); 116 expectAfter('delta', doCmd('nextLink'));
118 expectAfter('beta', doCmd('previousLink')); 117 expectAfter('beta', doCmd('previousLink'));
119 118
120 expectAfter('charlie', doCmd('nextHeading')); 119 expectAfter('charlie', doCmd('nextHeading'));
121 expectAfter('foxtraut', doCmd('nextHeading')); 120 expectAfter('foxtraut', doCmd('nextHeading'));
122 expectAfter('charlie', doCmd('previousHeading')); 121 expectAfter('charlie', doCmd('previousHeading'));
123 122
124 expectAfter('delta', doCmd('nextElement')); 123 expectAfter('delta', doCmd('nextElement'));
125 expectAfter('echo', doCmd('nextElement')); 124 expectAfter('echo', doCmd('nextElement'));
126 expectAfter('foxtraut', doCmd('nextElement')); 125 expectAfter('foxtraut', doCmd('nextElement'));
127 expectAfter('end', doCmd('nextElement')); 126 expectAfter('end', doCmd('nextElement'));
128 expectAfter('foxtraut', doCmd('previousElement')); 127 expectAfter('foxtraut', doCmd('previousElement'));
129 expectAfter('end of test', doCmd('nextLine')); 128 expectAfter('end of test', doCmd('nextLine'));
130 129
131 expectAfter('start', doCmd('goToBeginning')); 130 expectAfter('start', doCmd('goToBeginning'));
132 expectAfter('of test', doCmd('goToEnd')); 131 expectAfter('of test', doCmd('goToEnd'));
133 132
134 cvox.ChromeVox.tts.finishExpectations(); 133 cvox.ChromeVox.tts.finishExpectations();
135 }.bind(this) 134 }.bind(this)
136 ); 135 );
137 }); 136 });
138 137
139 TEST_F('BackgroundTest', 'CaretNavigation', function() { 138 TEST_F('BackgroundTest', 'CaretNavigation', function() {
140 cvox.ChromeVox.tts.expectSpeech('start', null, true); 139 cvox.ChromeVox.tts.expectSpeech('start', function() {
141 this.runWithDocument(this.linksAndHeadingsDoc, function() { 140 this.runWithAutomation(this.linksAndHeadingsDoc, function() {
142 var doCmd = this.doCmd.bind(this); 141 var doCmd = this.doCmd.bind(this);
143 var expectAfter = 142 var expectAfter =
144 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); 143 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts);
145 144
146 expectAfter('t', doCmd('nextCharacter'), true); 145 expectAfter('t', doCmd('nextCharacter'), true);
147 expectAfter('a', doCmd('nextCharacter'), true); 146 expectAfter('a', doCmd('nextCharacter'), true);
148 expectAfter('Link alpha', doCmd('nextWord'), true); 147 expectAfter('Link alpha', doCmd('nextWord'), true);
149 expectAfter('Link beta', doCmd('nextWord'), true); 148 expectAfter('Link beta', doCmd('nextWord'), true);
150 expectAfter('Heading charlie', doCmd('nextWord'), true); 149 expectAfter('Heading charlie', doCmd('nextWord'), true);
151 expectAfter('Link delta', doCmd('nextLine'), true); 150 expectAfter('Link delta', doCmd('nextLine'), true);
152 expectAfter('Link echo', doCmd('nextLine'), true); 151 expectAfter('Link echo', doCmd('nextLine'), true);
153 expectAfter('Heading foxtraut', doCmd('nextLine'), true); 152 expectAfter('Heading foxtraut', doCmd('nextLine'), true);
154 expectAfter( 153 expectAfter(
155 'end of test', doCmd('nextLine'), true); 154 'end of test', doCmd('nextLine'), true);
156 expectAfter('n', doCmd('nextCharacter'), true); 155 expectAfter('n', doCmd('nextCharacter'), true);
157 expectAfter('e', doCmd('previousCharacter'), true); 156 expectAfter('e', doCmd('previousCharacter'), true);
158 expectAfter('Heading t', doCmd('previousCharacter'), true); 157 expectAfter('Heading t', doCmd('previousCharacter'), true);
159 expectAfter('foxtraut', doCmd('previousWord'), true); 158 expectAfter('foxtraut', doCmd('previousWord'), true);
160 expectAfter('Link echo', doCmd('previousWord'), true); 159 expectAfter('Link echo', doCmd('previousWord'), true);
161 expectAfter('Link a', doCmd('previousCharacter'), true); 160 expectAfter('Link a', doCmd('previousCharacter'), true);
162 expectAfter('t', doCmd('previousCharacter'), true); 161 expectAfter('t', doCmd('previousCharacter'), true);
163 expectAfter('Link echo', doCmd('nextWord'), true); 162 expectAfter('Link echo', doCmd('nextWord'), true);
164 163
165 cvox.ChromeVox.tts.finishExpectations(); 164 cvox.ChromeVox.tts.finishExpectations();
166 }.bind(this)); 165 }.bind(this));
167 }); 166 });
168 167
169 // Flaky: http://crbug.com/451362 168 // Flaky: http://crbug.com/451362
170 TEST_F('BackgroundTest', 'DISABLED_SelectSingleBasic', function() { 169 TEST_F('BackgroundTest', 'DISABLED_SelectSingleBasic', function() {
171 this.runWithDocument(this.formsDoc, function(tabId) { 170 this.runWithAutomation(this.formsDoc, function(tabId) {
172 var sendDownToSelect = 171 var sendDownToSelect =
173 this.sendKeyToElement.bind(this, tabId, 'Down', '#fruitSelect'); 172 this.sendKeyToElement.bind(this, tabId, 'Down', '#fruitSelect');
174 var expect = cvox.ChromeVox.tts.expectSpeech.bind(cvox.ChromeVox.tts); 173 var expect = cvox.ChromeVox.tts.expectSpeech.bind(cvox.ChromeVox.tts);
175 expect('apple Menu item 1 of 3 ', sendDownToSelect, true); 174 expect('apple Menu item 1 of 3 ', sendDownToSelect, true);
176 expect('grape 2 of 3 ', sendDownToSelect, true); 175 expect('grape 2 of 3 ', sendDownToSelect, true);
177 expect('banana 3 of 3 ', testDone, true); 176 expect('banana 3 of 3 ', testDone, true);
178 cvox.ChromeVox.tts.finishExpectations(); 177 cvox.ChromeVox.tts.finishExpectations();
179 }.bind(this)); 178 }.bind(this));
180 }); 179 });
181 180
182 TEST_F('BackgroundTest', 'ContinuousRead', function() { 181 TEST_F('BackgroundTest', 'ContinuousRead', function() {
183 cvox.ChromeVox.tts.expectSpeech('start', null, true); 182 this.runWithAutomation(this.linksAndHeadingsDoc, function() {
184 this.runWithDocument(this.linksAndHeadingsDoc, function() {
185 var doCmd = this.doCmd.bind(this); 183 var doCmd = this.doCmd.bind(this);
186 var expect = 184 var expect =
187 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); 185 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts);
188 var sendEndEvent = function() { 186 var sendEndEvent =
189 window.setTimeout(function() { 187 cvox.ChromeVox.tts.sendEndEvent.bind(cvox.ChromeVox.tts);
190 this.sendEndEvent();
191 }.bind(this), 0);
192 }.bind(cvox.ChromeVox.tts);
193 188
194 expect('start', doCmd('continuousRead')); 189 expect('start', doCmd('continuousRead'));
195 expect('alpha Link', sendEndEvent); 190 expect('alpha Link', sendEndEvent);
196 expect('beta Link', sendEndEvent); 191 expect('beta Link', sendEndEvent);
197 expect('Heading charlie', sendEndEvent); 192 expect('Heading charlie', sendEndEvent);
198 cvox.ChromeVox.tts.finishExpectations(); 193 cvox.ChromeVox.tts.finishExpectations();
199 }.bind(this)); 194 }.bind(this));
200 }); 195 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698