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

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: Fix leaks? 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 cvox.ChromeVox.tts.expectSpeech('start', null, true);
110 this.runWithDocument(this.linksAndHeadingsDoc, function() { 110 this.runWithAutomation(this.linksAndHeadingsDoc, function() {
111 var doCmd = this.doCmd.bind(this); 111 var doCmd = this.doCmd.bind(this);
112 var expectAfter = 112 var expectAfter =
113 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); 113 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts);
114 114
115 expectAfter('alpha', doCmd('nextLink')); 115 expectAfter('alpha', doCmd('nextLink'));
116 expectAfter('beta', doCmd('nextLink')); 116 expectAfter('beta', doCmd('nextLink'));
117 expectAfter('delta', doCmd('nextLink')); 117 expectAfter('delta', doCmd('nextLink'));
118 expectAfter('beta', doCmd('previousLink')); 118 expectAfter('beta', doCmd('previousLink'));
119 119
120 expectAfter('charlie', doCmd('nextHeading')); 120 expectAfter('charlie', doCmd('nextHeading'));
(...skipping 10 matching lines...) Expand all
131 expectAfter('start', doCmd('goToBeginning')); 131 expectAfter('start', doCmd('goToBeginning'));
132 expectAfter('of test', doCmd('goToEnd')); 132 expectAfter('of test', doCmd('goToEnd'));
133 133
134 cvox.ChromeVox.tts.finishExpectations(); 134 cvox.ChromeVox.tts.finishExpectations();
135 }.bind(this) 135 }.bind(this)
136 ); 136 );
137 }); 137 });
138 138
139 TEST_F('BackgroundTest', 'CaretNavigation', function() { 139 TEST_F('BackgroundTest', 'CaretNavigation', function() {
140 cvox.ChromeVox.tts.expectSpeech('start', null, true); 140 cvox.ChromeVox.tts.expectSpeech('start', null, true);
141 this.runWithDocument(this.linksAndHeadingsDoc, function() { 141 this.runWithAutomation(this.linksAndHeadingsDoc, function() {
142 var doCmd = this.doCmd.bind(this); 142 var doCmd = this.doCmd.bind(this);
143 var expectAfter = 143 var expectAfter =
144 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); 144 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts);
145 145
146 expectAfter('t', doCmd('nextCharacter'), true); 146 expectAfter('t', doCmd('nextCharacter'), true);
147 expectAfter('a', doCmd('nextCharacter'), true); 147 expectAfter('a', doCmd('nextCharacter'), true);
148 expectAfter('Link alpha', doCmd('nextWord'), true); 148 expectAfter('Link alpha', doCmd('nextWord'), true);
149 expectAfter('Link beta', doCmd('nextWord'), true); 149 expectAfter('Link beta', doCmd('nextWord'), true);
150 expectAfter('Heading charlie', doCmd('nextWord'), true); 150 expectAfter('Heading charlie', doCmd('nextWord'), true);
151 expectAfter('Link delta', doCmd('nextLine'), true); 151 expectAfter('Link delta', doCmd('nextLine'), true);
152 expectAfter('Link echo', doCmd('nextLine'), true); 152 expectAfter('Link echo', doCmd('nextLine'), true);
153 expectAfter('Heading foxtraut', doCmd('nextLine'), true); 153 expectAfter('Heading foxtraut', doCmd('nextLine'), true);
154 expectAfter( 154 expectAfter(
155 'end of test', doCmd('nextLine'), true); 155 'end of test', doCmd('nextLine'), true);
156 expectAfter('n', doCmd('nextCharacter'), true); 156 expectAfter('n', doCmd('nextCharacter'), true);
157 expectAfter('e', doCmd('previousCharacter'), true); 157 expectAfter('e', doCmd('previousCharacter'), true);
158 expectAfter('Heading t', doCmd('previousCharacter'), true); 158 expectAfter('Heading t', doCmd('previousCharacter'), true);
159 expectAfter('foxtraut', doCmd('previousWord'), true); 159 expectAfter('foxtraut', doCmd('previousWord'), true);
160 expectAfter('Link echo', doCmd('previousWord'), true); 160 expectAfter('Link echo', doCmd('previousWord'), true);
161 expectAfter('Link a', doCmd('previousCharacter'), true); 161 expectAfter('Link a', doCmd('previousCharacter'), true);
162 expectAfter('t', doCmd('previousCharacter'), true); 162 expectAfter('t', doCmd('previousCharacter'), true);
163 expectAfter('Link echo', doCmd('nextWord'), true); 163 expectAfter('Link echo', doCmd('nextWord'), true);
164 164
165 cvox.ChromeVox.tts.finishExpectations(); 165 cvox.ChromeVox.tts.finishExpectations();
166 }.bind(this)); 166 }.bind(this));
167 }); 167 });
168 168
169 // Flaky: http://crbug.com/451362 169 // Flaky: http://crbug.com/451362
170 TEST_F('BackgroundTest', 'DISABLED_SelectSingleBasic', function() { 170 TEST_F('BackgroundTest', 'DISABLED_SelectSingleBasic', function() {
171 this.runWithDocument(this.formsDoc, function(tabId) { 171 this.runWithAutomation(this.formsDoc, function(tabId) {
172 var sendDownToSelect = 172 var sendDownToSelect =
173 this.sendKeyToElement.bind(this, tabId, 'Down', '#fruitSelect'); 173 this.sendKeyToElement.bind(this, tabId, 'Down', '#fruitSelect');
174 var expect = cvox.ChromeVox.tts.expectSpeech.bind(cvox.ChromeVox.tts); 174 var expect = cvox.ChromeVox.tts.expectSpeech.bind(cvox.ChromeVox.tts);
175 expect('apple Menu item 1 of 3 ', sendDownToSelect, true); 175 expect('apple Menu item 1 of 3 ', sendDownToSelect, true);
176 expect('grape 2 of 3 ', sendDownToSelect, true); 176 expect('grape 2 of 3 ', sendDownToSelect, true);
177 expect('banana 3 of 3 ', testDone, true); 177 expect('banana 3 of 3 ', testDone, true);
178 cvox.ChromeVox.tts.finishExpectations(); 178 cvox.ChromeVox.tts.finishExpectations();
179 }.bind(this)); 179 }.bind(this));
180 }); 180 });
181 181
182 TEST_F('BackgroundTest', 'ContinuousRead', function() { 182 TEST_F('BackgroundTest', 'ContinuousRead', function() {
183 cvox.ChromeVox.tts.expectSpeech('start', null, true); 183 cvox.ChromeVox.tts.expectSpeech('start', null, true);
184 this.runWithDocument(this.linksAndHeadingsDoc, function() { 184 this.runWithAutomation(this.linksAndHeadingsDoc, function() {
185 var doCmd = this.doCmd.bind(this); 185 var doCmd = this.doCmd.bind(this);
186 var expect = 186 var expect =
187 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts); 187 cvox.ChromeVox.tts.expectSpeechAfter.bind(cvox.ChromeVox.tts);
188 var sendEndEvent = function() { 188 var sendEndEvent = function() {
189 window.setTimeout(function() { 189 window.setTimeout(function() {
190 this.sendEndEvent(); 190 this.sendEndEvent();
191 }.bind(this), 0); 191 }.bind(this), 0);
192 }.bind(cvox.ChromeVox.tts); 192 }.bind(cvox.ChromeVox.tts);
193 193
194 expect('start', doCmd('continuousRead')); 194 expect('start', doCmd('continuousRead'));
195 expect('alpha Link', sendEndEvent); 195 expect('alpha Link', sendEndEvent);
196 expect('beta Link', sendEndEvent); 196 expect('beta Link', sendEndEvent);
197 expect('Heading charlie', sendEndEvent); 197 expect('Heading charlie', sendEndEvent);
198 cvox.ChromeVox.tts.finishExpectations(); 198 cvox.ChromeVox.tts.finishExpectations();
199 }.bind(this)); 199 }.bind(this));
200 }); 200 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698