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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 var focusButton = go.focus.bind(go); | 556 var focusButton = go.focus.bind(go); |
550 var focusSlider = slider.focus.bind(slider); | 557 var focusSlider = slider.focus.bind(slider); |
551 mockFeedback.call(focusButton) | 558 mockFeedback.call(focusButton) |
552 .expectNextSpeechUtteranceIsNot('noisy') | 559 .expectNextSpeechUtteranceIsNot('noisy') |
553 .call(focusSlider) | 560 .call(focusSlider) |
554 .expectSpeech('noisy') | 561 .expectSpeech('noisy') |
555 .expectSpeech('noisy') | 562 .expectSpeech('noisy') |
556 .replay(); | 563 .replay(); |
557 }.bind(this)); | 564 }.bind(this)); |
558 }); | 565 }); |
| 566 |
| 567 /** Tests navigating into and out of iframes.. */ |
| 568 TEST_F('BackgroundTest', 'ForwardNavigationThroughIframes', function() { |
| 569 var mockFeedback = this.createMockFeedback(); |
| 570 |
| 571 var runTestIfIframeIsLoaded = function(rootNode) { |
| 572 // Return if the iframe hasn't loaded yet. |
| 573 var iframe = rootNode.find({role: 'iframe'}); |
| 574 var childDoc = iframe.firstChild; |
| 575 if (childDoc && childDoc.children.length == 0) { |
| 576 return; |
| 577 } |
| 578 |
| 579 var doCmd = this.doCmd.bind(this); |
| 580 |
| 581 mockFeedback.expectSpeech('start').expectBraille('start'); |
| 582 |
| 583 mockFeedback.call(doCmd('nextButton')) |
| 584 .expectSpeech('Before', 'Button'); |
| 585 mockFeedback.call(doCmd('nextButton')) |
| 586 .expectSpeech('Inside', 'Button'); |
| 587 mockFeedback.call(doCmd('nextButton')) |
| 588 .expectSpeech('After', 'Button'); |
| 589 |
| 590 mockFeedback.replay(); |
| 591 }.bind(this); |
| 592 |
| 593 this.runWithLoadedTree(this.iframesDoc, function(rootNode) { |
| 594 chrome.automation.getDesktop(function(desktopNode) { |
| 595 runTestIfIframeIsLoaded(rootNode); |
| 596 |
| 597 desktopNode.addEventListener('loadComplete', function(evt) { |
| 598 runTestIfIframeIsLoaded(rootNode); |
| 599 }, true); |
| 600 }); |
| 601 }); |
| 602 }); |
OLD | NEW |