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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 <h2>foxtraut</h2> | 59 <h2>foxtraut</h2> |
60 <p>end<span>of test</span></p> | 60 <p>end<span>of test</span></p> |
61 */}, | 61 */}, |
62 | 62 |
63 formsDoc: function() {/*! | 63 formsDoc: function() {/*! |
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 |
| 71 iframesDoc: function() {/*! |
| 72 <p>start</p> |
| 73 <button>Before</button> |
| 74 <iframe srcdoc="<button>Inside</button>"></iframe> |
| 75 <button>After</button> |
| 76 */}, |
70 }; | 77 }; |
71 | 78 |
72 /** Tests that ChromeVox classic is in this context. */ | 79 /** Tests that ChromeVox classic is in this context. */ |
73 SYNC_TEST_F('BackgroundTest', 'ClassicNamespaces', function() { | 80 SYNC_TEST_F('BackgroundTest', 'ClassicNamespaces', function() { |
74 assertEquals('object', typeof(cvox)); | 81 assertEquals('object', typeof(cvox)); |
75 assertEquals('function', typeof(cvox.ChromeVoxBackground)); | 82 assertEquals('function', typeof(cvox.ChromeVoxBackground)); |
76 }); | 83 }); |
77 | 84 |
78 /** Tests that ChromeVox next is in this context. */ | 85 /** Tests that ChromeVox next is in this context. */ |
79 SYNC_TEST_F('BackgroundTest', 'NextNamespaces', function() { | 86 SYNC_TEST_F('BackgroundTest', 'NextNamespaces', function() { |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 .expectSpeech('go') | 586 .expectSpeech('go') |
580 .expectSpeech('Check box') | 587 .expectSpeech('Check box') |
581 .expectSpeech('checked') | 588 .expectSpeech('checked') |
582 .call(click) | 589 .call(click) |
583 .expectSpeech('go') | 590 .expectSpeech('go') |
584 .expectSpeech('Check box') | 591 .expectSpeech('Check box') |
585 .expectSpeech('not checked') | 592 .expectSpeech('not checked') |
586 .replay(); | 593 .replay(); |
587 }); | 594 }); |
588 }); | 595 }); |
| 596 |
| 597 /** Tests navigating into and out of iframes.. */ |
| 598 TEST_F('BackgroundTest', 'ForwardNavigationThroughIframes', function() { |
| 599 var mockFeedback = this.createMockFeedback(); |
| 600 |
| 601 var runTestIfIframeIsLoaded = function(rootNode) { |
| 602 // Return if the iframe hasn't loaded yet. |
| 603 var iframe = rootNode.find({role: 'iframe'}); |
| 604 var childDoc = iframe.firstChild; |
| 605 if (childDoc && childDoc.children.length == 0) { |
| 606 return; |
| 607 } |
| 608 |
| 609 var doCmd = this.doCmd.bind(this); |
| 610 |
| 611 mockFeedback.expectSpeech('start').expectBraille('start'); |
| 612 |
| 613 mockFeedback.call(doCmd('nextButton')) |
| 614 .expectSpeech('Before', 'Button'); |
| 615 mockFeedback.call(doCmd('nextButton')) |
| 616 .expectSpeech('Inside', 'Button'); |
| 617 mockFeedback.call(doCmd('nextButton')) |
| 618 .expectSpeech('After', 'Button'); |
| 619 |
| 620 mockFeedback.replay(); |
| 621 }.bind(this); |
| 622 |
| 623 this.runWithLoadedTree(this.iframesDoc, function(rootNode) { |
| 624 chrome.automation.getDesktop(function(desktopNode) { |
| 625 runTestIfIframeIsLoaded(rootNode); |
| 626 |
| 627 desktopNode.addEventListener('loadComplete', function(evt) { |
| 628 runTestIfIframeIsLoaded(rootNode); |
| 629 }, true); |
| 630 }); |
| 631 }); |
| 632 }); |
OLD | NEW |