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 a3b86067608b3ff95e73791df3afe7452376eeab..f380c6ca4c5b81696654d4c8ab120ec5e057011c 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background_test.extjs |
@@ -5,7 +5,7 @@ |
// Include test fixture. |
GEN_INCLUDE(['../../testing/chromevox_next_e2e_test_base.js']); |
-GEN_INCLUDE(['../../testing/mock_tts.js']); |
+GEN_INCLUDE(['../../testing/mock_feedback.js']); |
/** |
* Test fixture for Background. |
@@ -19,10 +19,13 @@ function BackgroundTest() { |
BackgroundTest.prototype = { |
__proto__: ChromeVoxNextE2ETest.prototype, |
- /** @override */ |
- setUp: function() { |
- this.mockTts = new MockTts(); |
- cvox.ChromeVox.tts = this.mockTts; |
+ /** |
+ * @return {!MockFeedback} |
+ */ |
+ createMockFeedback: function() { |
+ var mockFeedback = new MockFeedback(this.newCallback()); |
+ mockFeedback.install(); |
+ return mockFeedback; |
}, |
/** |
@@ -69,16 +72,6 @@ SYNC_TEST_F('BackgroundTest', 'NextNamespaces', function() { |
assertEquals('function', typeof(Background)); |
}); |
-/** Tests feedback once a page loads. */ |
-TEST_F('BackgroundTest', 'MANUAL_InitialFeedback', function() { |
- cvox.ChromeVox.tts.expectSpeech('start', this.newCallback()); |
- |
- this.runWithTab(function() {/*! |
- <p>start |
- <p>end |
- */}); |
-}); |
- |
/** Tests consistency of navigating forward and backward. */ |
TEST_F('BackgroundTest', 'MANUAL_ForwardBackwardNavigation', function() { |
this.runWithLoadedTree(this.linksAndHeadingsDoc, function() { |
@@ -166,6 +159,7 @@ TEST_F('BackgroundTest', 'MANUAL_ContinuousRead', function() { |
}); |
TEST_F('BackgroundTest', 'LiveRegionAddElement', function() { |
+ var mockFeedback = this.createMockFeedback(); |
this.runWithLoadedTree( |
function() {/*! |
<h1>Document with live region</h1> |
@@ -179,13 +173,14 @@ TEST_F('BackgroundTest', 'LiveRegionAddElement', function() { |
*/}, |
function(rootNode) { |
var go = rootNode.find({ role: chrome.automation.RoleType.button }); |
- go.doDefault(); |
- cvox.ChromeVox.tts.expectSpeech('Hello, world'); |
- cvox.ChromeVox.tts.finishExpectations(this.newCallback()); |
+ mockFeedback.call(go.doDefault.bind(go)) |
+ .expectSpeech('Hello, world') |
+ .go(); |
}); |
}); |
TEST_F('BackgroundTest', 'LiveRegionRemoveElement', function() { |
+ var mockFeedback = this.createMockFeedback(); |
this.runWithLoadedTree( |
function() {/*! |
<h1>Document with live region</h1> |
@@ -200,9 +195,9 @@ TEST_F('BackgroundTest', 'LiveRegionRemoveElement', function() { |
function(rootNode) { |
var go = rootNode.find({ role: chrome.automation.RoleType.button }); |
go.doDefault(); |
- cvox.ChromeVox.tts.expectSpeech('removed:'); |
- cvox.ChromeVox.tts.expectSpeech('Hello, world'); |
- cvox.ChromeVox.tts.finishExpectations(this.newCallback()); |
+ mockFeedback.expectSpeech('removed:') |
+ .expectSpeech('Hello, world') |
+ .go(); |
}); |
}); |
@@ -210,36 +205,40 @@ TEST_F('BackgroundTest', 'LiveRegionRemoveElement', function() { |
// focused. |
// http://crbug.com/520940 |
TEST_F('BackgroundTest', 'DISABLED_InitialFocus', function() { |
+ var mockFeedback = this.createMockFeedback(); |
this.runWithLoadedTree('<a href="a">a</a>', |
function(rootNode) { |
- cvox.ChromeVox.tts.expectSpeech('a'); |
- cvox.ChromeVox.tts.expectSpeech('Link', this.newCallback()); |
- |
- rootNode.focus(); |
+ mockFeedback.expectSpeech('a') |
+ .expectSpeech('Link') |
+ .go(); |
}); |
}); |
TEST_F('BackgroundTest', 'AriaLabel', function() { |
+ var mockFeedback = this.createMockFeedback(); |
this.runWithLoadedTree('<a aria-label="foo" href="a">a</a>', |
function(rootNode) { |
- cvox.ChromeVox.tts.expectSpeech('foo'); |
- cvox.ChromeVox.tts.expectSpeech('Link', this.newCallback()); |
rootNode.find({role: 'link'}).focus(); |
+ mockFeedback.expectSpeech('foo') |
+ .expectSpeech('Link') |
+ .expectBraille('foo lnk') |
+ .go(); |
} |
); |
}); |
TEST_F('BackgroundTest', 'ShowContextMenu', function() { |
+ var mockFeedback = this.createMockFeedback(); |
this.runWithLoadedTree('<a href="a">a</a>', |
function(rootNode) { |
- cvox.ChromeVox.tts.expectSpeech(' menu opened', this.newCallback( |
- function() { |
- // When shown, the context menu pushes a new message loop so test |
- // messages sent to the browser do not get processed. Ensure we exit |
- // the context menu here. |
- go.showContextMenu(); |
- }) |
- ); |
+ mockFeedback.expectSpeech(' menu opened') |
+ .call(function() { |
+ // When shown, the context menu pushes a new message loop so test |
+ // messages sent to the browser do not get processed. Ensure we |
+ // exit the context menu here. |
+ go.showContextMenu(); |
+ }) |
+ .go(); |
var go = rootNode.find({ role: chrome.automation.RoleType.link }); |
this.listenOnce(go, 'focus', function(e) { |