| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 var gotCmd = CommandHandler.onCommand; | 439 var gotCmd = CommandHandler.onCommand; |
| 440 | 440 |
| 441 // The command came from the background keyboard handler. | 441 // The command came from the background keyboard handler. |
| 442 var togglerFromBackground = gotCmd.bind(gotCmd, 'toggleChromeVoxVersion'); | 442 var togglerFromBackground = gotCmd.bind(gotCmd, 'toggleChromeVoxVersion'); |
| 443 | 443 |
| 444 // The command came from a content script. | 444 // The command came from a content script. |
| 445 var togglerFromContent = gotCmd.bind(gotCmd, 'toggleChromeVoxVersion', | 445 var togglerFromContent = gotCmd.bind(gotCmd, 'toggleChromeVoxVersion', |
| 446 true); | 446 true); |
| 447 | 447 |
| 448 mockFeedback.call(togglerFromBackground) | 448 mockFeedback.call(togglerFromBackground) |
| 449 .expectSpeech('Switched to Classic ChromeVox') | 449 .expectSpeech('Switched to Classic ChromeVox') |
| 450 .call(togglerFromContent) | 450 .call(togglerFromContent) |
| 451 .expectSpeech('Switched to ChromeVox Next') | 451 .expectSpeech('Switched to ChromeVox Next') |
| 452 .call(togglerFromBackground) | 452 .call(togglerFromBackground) |
| 453 .expectSpeech('Switched to Classic ChromeVox'); | 453 .expectSpeech('Switched to Classic ChromeVox'); |
| 454 mockFeedback.replay(); | 454 mockFeedback.replay(); |
| 455 }); | 455 }); |
| 456 }); | 456 }); |
| 457 | 457 |
| 458 SYNC_TEST_F('BackgroundTest', 'GlobsToRegExp', function() { | 458 SYNC_TEST_F('BackgroundTest', 'GlobsToRegExp', function() { |
| 459 assertEquals('/^()$/', Background.globsToRegExp_([]).toString()); | 459 assertEquals('/^()$/', Background.globsToRegExp_([]).toString()); |
| 460 assertEquals( | 460 assertEquals( |
| 461 '/^(http:\\/\\/host\\/path\\+here)$/', | 461 '/^(http:\\/\\/host\\/path\\+here)$/', |
| 462 Background.globsToRegExp_(['http://host/path+here']).toString()); | 462 Background.globsToRegExp_(['http://host/path+here']).toString()); |
| 463 assertEquals( | 463 assertEquals( |
| 464 '/^(url1.*|u.l2|.*url3)$/', | 464 '/^(url1.*|u.l2|.*url3)$/', |
| 465 Background.globsToRegExp_(['url1*', 'u?l2', '*url3']).toString()); | 465 Background.globsToRegExp_(['url1*', 'u?l2', '*url3']).toString()); |
| 466 }); | 466 }); |
| 467 | 467 |
| 468 // Flaky, see http://crbug.com/635032 |
| 468 TEST_F('BackgroundTest', 'ActiveOrInactive', function() { | 469 TEST_F('BackgroundTest', 'ActiveOrInactive', function() { |
| 469 var mockFeedback = this.createMockFeedback(); | 470 var mockFeedback = this.createMockFeedback(); |
| 470 this.runWithLoadedTree(function() {/*! | 471 this.runWithLoadedTree(function() {/*! |
| 471 <a href="a">a</a> | 472 <a href="a">a</a> |
| 472 <button>b</button> | 473 <button>b</button> |
| 473 <input type="text"></input> | 474 <input type="text"></input> |
| 474 */}, | 475 */}, |
| 475 function(rootNode) { | 476 function(rootNode) { |
| 476 var focusButton = function() { | 477 var focusButton = function() { |
| 477 rootNode.find({role: RoleType.button}).focus(); | 478 rootNode.find({role: RoleType.button}).focus(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 .expectSpeech('Before', 'Button'); | 679 .expectSpeech('Before', 'Button'); |
| 679 mockFeedback.replay(); | 680 mockFeedback.replay(); |
| 680 }.bind(this); | 681 }.bind(this); |
| 681 | 682 |
| 682 this.runWithLoadedTree(this.iframesDoc, function(rootNode) { | 683 this.runWithLoadedTree(this.iframesDoc, function(rootNode) { |
| 683 chrome.automation.getDesktop(function(desktopNode) { | 684 chrome.automation.getDesktop(function(desktopNode) { |
| 684 runTestIfIframeIsLoaded(rootNode); | 685 runTestIfIframeIsLoaded(rootNode); |
| 685 | 686 |
| 686 desktopNode.addEventListener('loadComplete', function(evt) { | 687 desktopNode.addEventListener('loadComplete', function(evt) { |
| 687 runTestIfIframeIsLoaded(rootNode); | 688 runTestIfIframeIsLoaded(rootNode); |
| 688 }, true); | 689 }, true); |
| 689 }); | 690 }); |
| 690 }); | 691 }); |
| 691 }); | 692 }); |
| 692 | 693 |
| 693 /** Tests navigating into and out of iframes using nextObject */ | 694 /** Tests navigating into and out of iframes using nextObject */ |
| 694 TEST_F('BackgroundTest', 'ForwardObjectNavigationThroughIframes', function() { | 695 TEST_F('BackgroundTest', 'ForwardObjectNavigationThroughIframes', function() { |
| 695 var mockFeedback = this.createMockFeedback(); | 696 var mockFeedback = this.createMockFeedback(); |
| 696 | 697 |
| 697 var running = false; | 698 var running = false; |
| 698 var runTestIfIframeIsLoaded = function(rootNode) { | 699 var runTestIfIframeIsLoaded = function(rootNode) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 724 .expectSpeech('Before', 'Button'); | 725 .expectSpeech('Before', 'Button'); |
| 725 mockFeedback.replay(); | 726 mockFeedback.replay(); |
| 726 }.bind(this); | 727 }.bind(this); |
| 727 | 728 |
| 728 this.runWithLoadedTree(this.iframesDoc, function(rootNode) { | 729 this.runWithLoadedTree(this.iframesDoc, function(rootNode) { |
| 729 chrome.automation.getDesktop(function(desktopNode) { | 730 chrome.automation.getDesktop(function(desktopNode) { |
| 730 runTestIfIframeIsLoaded(rootNode); | 731 runTestIfIframeIsLoaded(rootNode); |
| 731 | 732 |
| 732 desktopNode.addEventListener('loadComplete', function(evt) { | 733 desktopNode.addEventListener('loadComplete', function(evt) { |
| 733 runTestIfIframeIsLoaded(rootNode); | 734 runTestIfIframeIsLoaded(rootNode); |
| 734 }, true); | 735 }, true); |
| 735 }); | 736 }); |
| 736 }); | 737 }); |
| 737 }); | 738 }); |
| 738 | 739 |
| 739 TEST_F('BackgroundTest', 'SelectOptionSelected', function() { | 740 TEST_F('BackgroundTest', 'SelectOptionSelected', function() { |
| 740 var mockFeedback = this.createMockFeedback(); | 741 var mockFeedback = this.createMockFeedback(); |
| 741 this.runWithLoadedTree(function() {/*! | 742 this.runWithLoadedTree(function() {/*! |
| 742 <select> | 743 <select> |
| 743 <option>apple | 744 <option>apple |
| 744 <option>banana | 745 <option>banana |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 .call(doCmd('nextHeading' + level)) | 1125 .call(doCmd('nextHeading' + level)) |
| 1125 .expectSpeech('No next level ' + level + ' heading.') | 1126 .expectSpeech('No next level ' + level + ' heading.') |
| 1126 .call(doCmd('previousHeading' + level)) | 1127 .call(doCmd('previousHeading' + level)) |
| 1127 .expectSpeech('No previous level ' + level + ' heading.'); | 1128 .expectSpeech('No previous level ' + level + ' heading.'); |
| 1128 }; | 1129 }; |
| 1129 for (var i = 1; i <= 6; i++) | 1130 for (var i = 1; i <= 6; i++) |
| 1130 makeLevelAssertions(i); | 1131 makeLevelAssertions(i); |
| 1131 mockFeedback.replay(); | 1132 mockFeedback.replay(); |
| 1132 }); | 1133 }); |
| 1133 }); | 1134 }); |
| OLD | NEW |