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

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

Issue 2007183002: Make ChromeVox cursor robust to deleted nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
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 61e8b2124c2900aa1de3577d99948e55fd5c4b2c..9153981691d3d8737f8d869e157430ced51c22ad 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs
@@ -74,6 +74,33 @@ BackgroundTest.prototype = {
<iframe srcdoc="<button>Inside</button>"></iframe>
<button>After</button>
*/},
+
+ disappearingObjectDoc: function() {/*!
+ <p>start</p>
+ <article>
+ <p>Before1</p>
+ <p>Before2</p>
+ <p>Before3</p>
+ </article>
+ <article>
+ <p id="disappearing">Disappearing</p>
+ </article>
+ <article>
+ <p>After1</p>
+ <p>After2</p>
+ <p>After3</p>
+ </article>
+ </div>
+ <div id="live" aria-live="polite"></div>
+ <div id="delete" role="button">Delete</div>
+ <script>
+ document.getElementById('delete').addEventListener('click', function() {
+ var d = document.getElementById('disappearing');
+ d.parentElement.removeChild(d);
+ document.getElementById('live').innerText = 'Deleted';
+ });
+ </script>
+ */},
};
/** Tests that ChromeVox classic is in this context. */
@@ -239,7 +266,7 @@ TEST_F('BackgroundTest', 'AriaLabel', function() {
var mockFeedback = this.createMockFeedback();
this.runWithLoadedTree('<a aria-label="foo" href="a">a</a>',
function(rootNode) {
- rootNode.find({role: 'link'}).focus();
+ rootNode.find({role: RoleType.link}).focus();
mockFeedback.expectSpeech('foo')
.expectSpeech('Link')
.expectBraille('foo lnk');
@@ -293,7 +320,7 @@ TEST_F('BackgroundTest', 'BrailleRouting', function() {
*/},
function(rootNode) {
var button1 = rootNode.find({role: RoleType.button,
- name: 'Click me'});
+ attributes: { name: 'Click me' }});
var textField = rootNode.find(
{role: RoleType.textField});
mockFeedback.expectBraille('start')
@@ -450,7 +477,9 @@ TEST_F('BackgroundTest', 'ActiveOrInactive', function() {
<input type="text"></input>
*/},
function(rootNode) {
- var focusButton = function() { rootNode.find({role: 'button'}).focus(); };
+ var focusButton = function() {
+ rootNode.find({role: RoleType.button}).focus();
+ };
var on = function() { cvox.ChromeVox.isActive = true; };
var off = function() { cvox.ChromeVox.isActive = false; };
@@ -467,8 +496,10 @@ TEST_F('BackgroundTest', 'ActiveOrInactive', function() {
mockFeedback.call(focusButton)
.expectSpeech('b').expectSpeech('Button')
.call(off)
- .call(focusThen.bind(this, rootNode.find({ role: 'link' }), on))
- .call(focusThen.bind(this, rootNode.find({ role: 'textField' })))
+ .call(focusThen.bind(this, rootNode.find(
+ { role: RoleType.link }), on))
+ .call(focusThen.bind(this, rootNode.find(
+ { role: RoleType.textField })))
.expectNextSpeechUtteranceIsNot('a')
.expectSpeech('Edit text');
@@ -542,8 +573,8 @@ TEST_F('BackgroundTest', 'FocusIframe', function() {
<iframe tabindex=0 src="data:text/html,<p>Inside</p>"></iframe>
<button>outside</button>
*/}, function(root) {
- var iframe = root.find({role: 'iframe'});
- var button = root.find({role: 'button'});
+ var iframe = root.find({role: RoleType.iframe});
+ var button = root.find({role: RoleType.button});
assertEquals('iframe', iframe.role);
assertEquals('button', button.role);
@@ -573,8 +604,8 @@ TEST_F('BackgroundTest', 'NoisySlider', function() {
update();
</script>
*/}, function(root) {
- var go = root.find({role: 'button'});
- var slider = root.find({role: 'slider'});
+ var go = root.find({role: RoleType.button});
+ var slider = root.find({role: RoleType.slider});
var focusButton = go.focus.bind(go);
var focusSlider = slider.focus.bind(slider);
mockFeedback.call(focusButton)
@@ -602,7 +633,7 @@ TEST_F('BackgroundTest', 'Checkbox', function() {
});
</script>
*/}, function(root) {
- var cbx = root.find({role: 'checkBox'});
+ var cbx = root.find({role: RoleType.checkBox});
var click = cbx.doDefault.bind(cbx);
mockFeedback.call(click)
.expectSpeech('go')
@@ -622,7 +653,7 @@ TEST_F('BackgroundTest', 'DISABLED_ForwardNavigationThroughIframes', function()
var runTestIfIframeIsLoaded = function(rootNode) {
// Return if the iframe hasn't loaded yet.
- var iframe = rootNode.find({role: 'iframe'});
+ var iframe = rootNode.find({role: RoleType.iframe});
var childDoc = iframe.firstChild;
if (childDoc && childDoc.children.length == 0) {
return;
@@ -662,7 +693,7 @@ TEST_F('BackgroundTest', 'SelectOptionSelected', function() {
<option>grapefruit
</select>
*/}, function(root) {
- var select = root.find({role: 'popUpButton'});
+ var select = root.find({role: RoleType.popUpButton});
var clickSelect = select.doDefault.bind(select);
var lastOption = select.lastChild.lastChild;
var selectLastOption = lastOption.doDefault.bind(lastOption);
@@ -676,3 +707,40 @@ TEST_F('BackgroundTest', 'SelectOptionSelected', function() {
.replay();
});
});
+
+/** Tests that navigation works when the current object disappears. */
+TEST_F('BackgroundTest', 'DisappearingObject', function() {
+ var mockFeedback = this.createMockFeedback();
+ this.runWithLoadedTree(this.disappearingObjectDoc, function(rootNode) {
+ var deleteButton = rootNode.find({role: RoleType.button,
+ attributes: { name: 'Delete' }});
+ var pressDelete = deleteButton.doDefault.bind(deleteButton);
+ var doCmd = this.doCmd.bind(this);
+
+ mockFeedback.expectSpeech('start').expectBraille('start');
+
+ mockFeedback.call(doCmd('nextObject'))
+ .expectSpeech('Before1')
+ .call(doCmd('nextObject'))
+ .expectSpeech('Before2')
+ .call(doCmd('nextObject'))
+ .expectSpeech('Before3')
+ .call(doCmd('nextObject'))
+ .expectSpeech('Disappearing')
+ .call(pressDelete)
+ .expectSpeech('Deleted')
+ .call(doCmd('nextObject'))
+ .expectSpeech('After1')
+ .call(doCmd('nextObject'))
+ .expectSpeech('After2')
+ .call(doCmd('previousObject'))
+ .expectSpeech('After1')
+ .call(doCmd('previousObject'))
+ .expectSpeech('Article')
+ .call(doCmd('previousObject'))
+ .expectSpeech('Before3');
+
+ mockFeedback.replay();
+ });
+});
+

Powered by Google App Engine
This is Rietveld 408576698