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 fbeb83669429a31d29de999f21ed36af7787b403..c443c93e63a589398195d81042ff00ae86eb53bc 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs |
@@ -232,7 +232,7 @@ TEST_F('BackgroundTest', 'LiveRegionAddElement', function() { |
function(rootNode) { |
var go = rootNode.find({ role: RoleType.button }); |
mockFeedback.call(go.doDefault.bind(go)) |
- .expectSpeech('Hello, world'); |
+ .expectCategoryFlush('Hello, world'); |
mockFeedback.replay(); |
}); |
}); |
@@ -253,8 +253,132 @@ TEST_F('BackgroundTest', 'LiveRegionRemoveElement', function() { |
function(rootNode) { |
var go = rootNode.find({ role: RoleType.button }); |
go.doDefault(); |
- mockFeedback.expectSpeech('removed:') |
- .expectSpeech('Hello, world'); |
+ mockFeedback.expectCategoryFlush('removed:') |
+ .expectQueue('Hello, world'); |
+ mockFeedback.replay(); |
+ }); |
+}); |
+ |
+TEST_F('BackgroundTest', 'LiveRegionChangeAtomic', function() { |
+ var mockFeedback = this.createMockFeedback(); |
+ this.runWithLoadedTree( |
+ function() {/*! |
+ <div id="live" aria-live="polite" aria-atomic="true"> |
+ <div id="a"></div><div id="b">Bravo</div><div id="c"></div> |
+ </div> |
+ <button id="go">Go</button> |
+ <script> |
+ document.getElementById('go').addEventListener('click', function() { |
+ document.getElementById('c').textContent = 'Charlie'; |
+ document.getElementById('a').textContent = 'Alpha'; |
+ }, false); |
+ </script> |
+ */}, |
+ function(rootNode) { |
+ var go = rootNode.find({ role: RoleType.button }); |
+ mockFeedback.call(go.doDefault.bind(go)) |
+ .expectQueue('Alpha') |
+ .expectQueue('Bravo') |
+ .expectQueue('Charlie'); |
+ mockFeedback.replay(); |
+ }); |
+}); |
+ |
+TEST_F('BackgroundTest', 'LiveRegionChangeImageAlt', function() { |
+ var mockFeedback = this.createMockFeedback(); |
+ this.runWithLoadedTree( |
+ function() {/*! |
+ <div id="live" aria-live="polite"> |
+ <img id="img" src="#" alt="Before"> |
+ </div> |
+ <button id="go">Go</button> |
+ <script> |
+ document.getElementById('go').addEventListener('click', function() { |
+ document.getElementById('img').setAttribute('alt', 'After'); |
+ }, false); |
+ </script> |
+ */}, |
+ function(rootNode) { |
+ var go = rootNode.find({ role: RoleType.button }); |
+ mockFeedback.call(go.doDefault.bind(go)) |
+ .expectCategoryFlush('After') |
+ .expectQueue('Image'); |
+ mockFeedback.replay(); |
+ }); |
+}); |
+ |
+TEST_F('BackgroundTest', 'LiveRegionThenFocus', function() { |
+ var mockFeedback = this.createMockFeedback(); |
+ this.runWithLoadedTree( |
+ function() {/*! |
+ <div id="live" aria-live="polite"></div> |
+ <button id="go">Go</button> |
+ <button id="focus">Focus</button> |
+ <script> |
+ document.getElementById('go').addEventListener('click', function() { |
+ document.getElementById('live').textContent = 'Live'; |
+ window.setTimeout(function() { |
+ document.getElementById('focus').focus(); |
+ }, 50); |
+ }, false); |
+ </script> |
+ */}, |
+ function(rootNode) { |
+ var go = rootNode.find({ role: RoleType.button }); |
+ mockFeedback.call(go.doDefault.bind(go)) |
+ .expectCategoryFlush('Live') |
+ .expectQueue('Focus'); |
+ mockFeedback.replay(); |
+ }); |
+}); |
+ |
+TEST_F('BackgroundTest', 'FocusThenLiveRegion', function() { |
+ var mockFeedback = this.createMockFeedback(); |
+ this.runWithLoadedTree( |
+ function() {/*! |
+ <div id="live" aria-live="polite"></div> |
+ <button id="go">Go</button> |
+ <button id="focus">Focus</button> |
+ <script> |
+ document.getElementById('go').addEventListener('click', function() { |
+ document.getElementById('focus').focus(); |
+ window.setTimeout(function() { |
+ document.getElementById('live').textContent = 'Live'; |
+ }, 50); |
+ }, false); |
+ </script> |
+ */}, |
+ function(rootNode) { |
+ var go = rootNode.find({ role: RoleType.button }); |
+ mockFeedback.call(go.doDefault.bind(go)) |
+ .expectQueue('Focus') |
+ .expectCategoryFlush('Live'); |
+ mockFeedback.replay(); |
+ }); |
+}); |
+ |
+TEST_F('BackgroundTest', 'LiveRegionCategoryFlush', function() { |
+ var mockFeedback = this.createMockFeedback(); |
+ this.runWithLoadedTree( |
+ function() {/*! |
+ <div id="live1" aria-live="polite"></div> |
+ <div id="live2" aria-live="polite"></div> |
+ <button id="go">Go</button> |
+ <button id="focus">Focus</button> |
+ <script> |
+ document.getElementById('go').addEventListener('click', function() { |
+ document.getElementById('live1').textContent = 'Live1'; |
+ window.setTimeout(function() { |
+ document.getElementById('live2').textContent = 'Live2'; |
+ }, 1000); |
+ }, false); |
+ </script> |
+ */}, |
+ function(rootNode) { |
+ var go = rootNode.find({ role: RoleType.button }); |
+ mockFeedback.call(go.doDefault.bind(go)) |
+ .expectCategoryFlush('Live1') |
+ .expectCategoryFlush('Live2'); |
mockFeedback.replay(); |
}); |
}); |