| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 <select id="fruitSelect"> | 64 <select id="fruitSelect"> |
| 65 <option>apple</option> | 65 <option>apple</option> |
| 66 <option>grape</option> | 66 <option>grape</option> |
| 67 <option> banana</option> | 67 <option> banana</option> |
| 68 </select> | 68 </select> |
| 69 */}, | 69 */}, |
| 70 | 70 |
| 71 iframesDoc: function() {/*! | 71 iframesDoc: function() {/*! |
| 72 <p>start</p> | 72 <p>start</p> |
| 73 <button>Before</button> | 73 <button>Before</button> |
| 74 <iframe srcdoc="<button>Inside</button>"></iframe> | 74 <iframe srcdoc="<button>Inside</button><h1>Inside</h1>"></iframe> |
| 75 <button>After</button> | 75 <button>After</button> |
| 76 */}, | 76 */}, |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 /** Tests that ChromeVox classic is in this context. */ | 79 /** Tests that ChromeVox classic is in this context. */ |
| 80 SYNC_TEST_F('BackgroundTest', 'ClassicNamespaces', function() { | 80 SYNC_TEST_F('BackgroundTest', 'ClassicNamespaces', function() { |
| 81 assertEquals('object', typeof(cvox)); | 81 assertEquals('object', typeof(cvox)); |
| 82 assertEquals('function', typeof(cvox.ChromeVoxBackground)); | 82 assertEquals('function', typeof(cvox.ChromeVoxBackground)); |
| 83 }); | 83 }); |
| 84 | 84 |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 .expectSpeech('Check box') | 609 .expectSpeech('Check box') |
| 610 .expectSpeech('checked') | 610 .expectSpeech('checked') |
| 611 .call(click) | 611 .call(click) |
| 612 .expectSpeech('go') | 612 .expectSpeech('go') |
| 613 .expectSpeech('Check box') | 613 .expectSpeech('Check box') |
| 614 .expectSpeech('not checked') | 614 .expectSpeech('not checked') |
| 615 .replay(); | 615 .replay(); |
| 616 }); | 616 }); |
| 617 }); | 617 }); |
| 618 | 618 |
| 619 /** Tests navigating into and out of iframes.. */ | 619 /** Tests navigating into and out of iframes using nextButton */ |
| 620 TEST_F('BackgroundTest', 'DISABLED_ForwardNavigationThroughIframes', function()
{ | 620 TEST_F('BackgroundTest', 'ForwardNavigationThroughIframeButtons', function() { |
| 621 var mockFeedback = this.createMockFeedback(); | 621 var mockFeedback = this.createMockFeedback(); |
| 622 | 622 |
| 623 var running = false; |
| 623 var runTestIfIframeIsLoaded = function(rootNode) { | 624 var runTestIfIframeIsLoaded = function(rootNode) { |
| 625 if (running) |
| 626 return; |
| 627 |
| 624 // Return if the iframe hasn't loaded yet. | 628 // Return if the iframe hasn't loaded yet. |
| 625 var iframe = rootNode.find({role: 'iframe'}); | 629 var iframe = rootNode.find({role: 'iframe'}); |
| 626 var childDoc = iframe.firstChild; | 630 var childDoc = iframe.firstChild; |
| 627 if (childDoc && childDoc.children.length == 0) { | 631 if (!childDoc || childDoc.children.length == 0) |
| 628 return; | 632 return; |
| 629 } | |
| 630 | 633 |
| 634 running = true; |
| 631 var doCmd = this.doCmd.bind(this); | 635 var doCmd = this.doCmd.bind(this); |
| 632 | 636 |
| 633 mockFeedback.expectSpeech('start').expectBraille('start'); | 637 var beforeButton = rootNode.find({role: RoleType.button, |
| 634 | 638 name: 'Before'}); |
| 635 mockFeedback.call(doCmd('nextButton')) | 639 beforeButton.focus(); |
| 636 .expectSpeech('Before', 'Button'); | 640 mockFeedback.expectSpeech('Before', 'Button'); |
| 637 mockFeedback.call(doCmd('nextButton')) | 641 mockFeedback.call(doCmd('nextButton')) |
| 638 .expectSpeech('Inside', 'Button'); | 642 .expectSpeech('Inside', 'Button'); |
| 639 mockFeedback.call(doCmd('nextButton')) | 643 mockFeedback.call(doCmd('nextButton')) |
| 640 .expectSpeech('After', 'Button'); | 644 .expectSpeech('After', 'Button'); |
| 641 | 645 mockFeedback.call(doCmd('previousButton')) |
| 646 .expectSpeech('Inside', 'Button'); |
| 647 mockFeedback.call(doCmd('previousButton')) |
| 648 .expectSpeech('Before', 'Button'); |
| 642 mockFeedback.replay(); | 649 mockFeedback.replay(); |
| 643 }.bind(this); | 650 }.bind(this); |
| 644 | 651 |
| 652 this.runWithLoadedTree(this.iframesDoc, function(rootNode) { |
| 653 chrome.automation.getDesktop(function(desktopNode) { |
| 654 runTestIfIframeIsLoaded(rootNode); |
| 655 |
| 656 desktopNode.addEventListener('loadComplete', function(evt) { |
| 657 runTestIfIframeIsLoaded(rootNode); |
| 658 }, true); |
| 659 }); |
| 660 }); |
| 661 }); |
| 662 |
| 663 /** Tests navigating into and out of iframes using nextObject */ |
| 664 TEST_F('BackgroundTest', 'ForwardObjectNavigationThroughIframes', function() { |
| 665 var mockFeedback = this.createMockFeedback(); |
| 666 |
| 667 var running = false; |
| 668 var runTestIfIframeIsLoaded = function(rootNode) { |
| 669 if (running) |
| 670 return; |
| 671 |
| 672 // Return if the iframe hasn't loaded yet. |
| 673 var iframe = rootNode.find({role: 'iframe'}); |
| 674 var childDoc = iframe.firstChild; |
| 675 if (!childDoc || childDoc.children.length == 0) |
| 676 return; |
| 677 |
| 678 running = true; |
| 679 var doCmd = this.doCmd.bind(this); |
| 680 |
| 681 var beforeButton = rootNode.find({role: RoleType.button, |
| 682 name: 'Before'}); |
| 683 beforeButton.focus(); |
| 684 mockFeedback.expectSpeech('Before', 'Button'); |
| 685 mockFeedback.call(doCmd('nextObject')) |
| 686 .expectSpeech('Inside', 'Button'); |
| 687 mockFeedback.call(doCmd('nextObject')) |
| 688 .expectSpeech('Inside', 'Heading 1'); |
| 689 mockFeedback.call(doCmd('nextObject')) |
| 690 .expectSpeech('After', 'Button'); |
| 691 mockFeedback.call(doCmd('previousObject')) |
| 692 .expectSpeech('Inside', 'Heading 1'); |
| 693 mockFeedback.call(doCmd('previousObject')) |
| 694 .expectSpeech('Inside', 'Button'); |
| 695 mockFeedback.call(doCmd('previousObject')) |
| 696 .expectSpeech('Before', 'Button'); |
| 697 mockFeedback.replay(); |
| 698 }.bind(this); |
| 699 |
| 645 this.runWithLoadedTree(this.iframesDoc, function(rootNode) { | 700 this.runWithLoadedTree(this.iframesDoc, function(rootNode) { |
| 646 chrome.automation.getDesktop(function(desktopNode) { | 701 chrome.automation.getDesktop(function(desktopNode) { |
| 647 runTestIfIframeIsLoaded(rootNode); | 702 runTestIfIframeIsLoaded(rootNode); |
| 648 | 703 |
| 649 desktopNode.addEventListener('loadComplete', function(evt) { | 704 desktopNode.addEventListener('loadComplete', function(evt) { |
| 650 runTestIfIframeIsLoaded(rootNode); | 705 runTestIfIframeIsLoaded(rootNode); |
| 651 }, true); | 706 }, true); |
| 652 }); | 707 }); |
| 653 }); | 708 }); |
| 654 }); | 709 }); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 669 | 724 |
| 670 mockFeedback.call(clickSelect) | 725 mockFeedback.call(clickSelect) |
| 671 .expectSpeech('apple') | 726 .expectSpeech('apple') |
| 672 .expectSpeech('Button') | 727 .expectSpeech('Button') |
| 673 .call(selectLastOption) | 728 .call(selectLastOption) |
| 674 .expectNextSpeechUtteranceIsNot('apple') | 729 .expectNextSpeechUtteranceIsNot('apple') |
| 675 .expectSpeech('grapefruit') | 730 .expectSpeech('grapefruit') |
| 676 .replay(); | 731 .replay(); |
| 677 }); | 732 }); |
| 678 }); | 733 }); |
| OLD | NEW |