| OLD | NEW |
| 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 '../../testing/assert_additions.js']); | 7 '../../testing/assert_additions.js']); |
| 8 | 8 |
| 9 GEN_INCLUDE(['../../testing/mock_feedback.js']); | 9 GEN_INCLUDE(['../../testing/mock_feedback.js']); |
| 10 | 10 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 .expectBraille('foo lnk'); | 269 .expectBraille('foo lnk'); |
| 270 mockFeedback.replay(); | 270 mockFeedback.replay(); |
| 271 } | 271 } |
| 272 ); | 272 ); |
| 273 }); | 273 }); |
| 274 | 274 |
| 275 TEST_F('BackgroundTest', 'ShowContextMenu', function() { | 275 TEST_F('BackgroundTest', 'ShowContextMenu', function() { |
| 276 var mockFeedback = this.createMockFeedback(); | 276 var mockFeedback = this.createMockFeedback(); |
| 277 this.runWithLoadedTree('<p>before</p><a href="a">a</a>', | 277 this.runWithLoadedTree('<p>before</p><a href="a">a</a>', |
| 278 function(rootNode) { | 278 function(rootNode) { |
| 279 mockFeedback.expectSpeech(/menu opened/) | 279 var go = rootNode.find({ role: RoleType.link }); |
| 280 .call(function() { | 280 // Menus no longer nest a message loop, so we can launch menu and confirm |
| 281 // When shown, the context menu pushes a new message loop so test | 281 // expected speech. The menu will not block test shutdown. |
| 282 // messages sent to the browser do not get processed. Ensure we | 282 mockFeedback.call(go.focus.bind(go)) |
| 283 // exit the context menu here. | 283 .expectSpeech('a', 'Link') |
| 284 go.showContextMenu(); | 284 .call(doCmd('contextMenu')) |
| 285 }); | 285 .expectSpeech(/menu opened/); |
| 286 mockFeedback.replay(); | 286 mockFeedback.replay(); |
| 287 | |
| 288 var go = rootNode.find({ role: RoleType.link }); | |
| 289 this.listenOnce(go, 'focus', function(e) { | |
| 290 doCmd('contextMenu')(); | |
| 291 }.bind(this), true); | |
| 292 go.focus(); | |
| 293 }.bind(this)); | 287 }.bind(this)); |
| 294 }); | 288 }); |
| 295 | 289 |
| 296 TEST_F('BackgroundTest', 'BrailleRouting', function() { | 290 TEST_F('BackgroundTest', 'BrailleRouting', function() { |
| 297 var mockFeedback = this.createMockFeedback(); | 291 var mockFeedback = this.createMockFeedback(); |
| 298 var route = function(position) { | 292 var route = function(position) { |
| 299 assertTrue(ChromeVoxState.instance.onBrailleKeyEvent( | 293 assertTrue(ChromeVoxState.instance.onBrailleKeyEvent( |
| 300 {command: cvox.BrailleKeyCommand.ROUTING, | 294 {command: cvox.BrailleKeyCommand.ROUTING, |
| 301 displayPosition: position}, | 295 displayPosition: position}, |
| 302 mockFeedback.lastMatchedBraille)); | 296 mockFeedback.lastMatchedBraille)); |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 .call(doCmd('nextHeading' + level)) | 1119 .call(doCmd('nextHeading' + level)) |
| 1126 .expectSpeech('No next level ' + level + ' heading.') | 1120 .expectSpeech('No next level ' + level + ' heading.') |
| 1127 .call(doCmd('previousHeading' + level)) | 1121 .call(doCmd('previousHeading' + level)) |
| 1128 .expectSpeech('No previous level ' + level + ' heading.'); | 1122 .expectSpeech('No previous level ' + level + ' heading.'); |
| 1129 }; | 1123 }; |
| 1130 for (var i = 1; i <= 6; i++) | 1124 for (var i = 1; i <= 6; i++) |
| 1131 makeLevelAssertions(i); | 1125 makeLevelAssertions(i); |
| 1132 mockFeedback.replay(); | 1126 mockFeedback.replay(); |
| 1133 }); | 1127 }); |
| 1134 }); | 1128 }); |
| OLD | NEW |