| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 // Force next mode stays set regardless of where the range lands. | 527 // Force next mode stays set regardless of where the range lands. |
| 528 fakeWebRoot.docUrl = 'http://google.com'; | 528 fakeWebRoot.docUrl = 'http://google.com'; |
| 529 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); | 529 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); |
| 530 assertEquals('force_next', bk.mode); | 530 assertEquals('force_next', bk.mode); |
| 531 // Empty urls occur before document load or when root is desktop. | 531 // Empty urls occur before document load or when root is desktop. |
| 532 fakeWebRoot.docUrl = ''; | 532 fakeWebRoot.docUrl = ''; |
| 533 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); | 533 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); |
| 534 assertEquals('force_next', bk.mode); | 534 assertEquals('force_next', bk.mode); |
| 535 | 535 |
| 536 // Verify force next -> classic compat switching. | 536 // Verify force next -> classic compat switching. |
| 537 localStorage['useNext'] = false; | 537 localStorage['useClassic'] = true; |
| 538 fakeWebRoot.docUrl = 'chrome://foobar'; | 538 fakeWebRoot.docUrl = 'chrome://foobar'; |
| 539 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); | 539 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); |
| 540 assertEquals('classic_compat', bk.mode); | 540 assertEquals('classic_compat', bk.mode); |
| 541 | 541 |
| 542 // Classic compat -> classic. | 542 // Classic compat -> classic. |
| 543 fakeWebRoot.docUrl = 'http://google.com'; | 543 fakeWebRoot.docUrl = 'http://google.com'; |
| 544 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); | 544 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); |
| 545 assertEquals('classic', bk.mode); | 545 assertEquals('classic', bk.mode); |
| 546 | 546 |
| 547 // Ensure we switch to classic compat if our current range has focused | 547 // Ensure we switch to classic compat if our current range has focused |
| 548 // state set and is not in web content. | 548 // state set and is not in web content. |
| 549 assertTrue(root.parent.state.focused); | 549 assertTrue(root.parent.state.focused); |
| 550 bk.setCurrentRange(cursors.Range.fromNode(root.parent)); | 550 bk.setCurrentRange(cursors.Range.fromNode(root.parent)); |
| 551 assertEquals('classic_compat', bk.mode); | 551 assertEquals('classic_compat', bk.mode); |
| 552 | 552 |
| 553 // And back to classic. | 553 // And back to classic. |
| 554 bk.setCurrentRange(cursors.Range.fromNode(root)); | 554 bk.setCurrentRange(cursors.Range.fromNode(root)); |
| 555 assertEquals('classic', bk.mode); | 555 assertEquals('classic', bk.mode); |
| 556 | 556 |
| 557 // Now, verify mode switching uses the top level root. | 557 // Now, verify mode switching uses the top level root. |
| 558 fakeWebRoot.docUrl = 'http://google.com/#chromevox_next_test'; | 558 fakeWebRoot.docUrl = 'http://google.com/#chromevox_next_test'; |
| 559 fakeSubRoot.docUrl = 'http://chromevox.com'; | 559 fakeSubRoot.docUrl = 'http://chromevox.com'; |
| 560 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); | 560 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); |
| 561 assertEquals('next', bk.mode); | 561 assertEquals('next', bk.mode); |
| 562 | 562 |
| 563 // Next compat switching. | 563 // Next compat switching. |
| 564 localStorage['useNext'] = true; | 564 localStorage['useClassic'] = false; |
| 565 fakeWebRoot.docUrl = 'http://docs.google.com/document/#123123'; | 565 fakeWebRoot.docUrl = 'http://docs.google.com/document/#123123'; |
| 566 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); | 566 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); |
| 567 assertEquals('next_compat', bk.mode); | 567 assertEquals('next_compat', bk.mode); |
| 568 | 568 |
| 569 // And, back to force next. | 569 // And, back to force next. |
| 570 fakeWebRoot.docUrl = 'http://docs.google.com/form/123'; | 570 fakeWebRoot.docUrl = 'http://docs.google.com/form/123'; |
| 571 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); | 571 bk.setCurrentRange(cursors.Range.fromNode(fakeWebRoot)); |
| 572 assertEquals('force_next', bk.mode); | 572 assertEquals('force_next', bk.mode); |
| 573 }.bind(this)); | 573 }.bind(this)); |
| 574 }); | 574 }); |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 .call(doCmd('nextWord')) | 1220 .call(doCmd('nextWord')) |
| 1221 .expectBraille(text, {startIndex: 5, endIndex: 7}) // is | 1221 .expectBraille(text, {startIndex: 5, endIndex: 7}) // is |
| 1222 .call(doCmd('previousWord')) | 1222 .call(doCmd('previousWord')) |
| 1223 .expectBraille(text, {startIndex: 0, endIndex: 4}) // This | 1223 .expectBraille(text, {startIndex: 0, endIndex: 4}) // This |
| 1224 .call(doCmd('nextLine')) | 1224 .call(doCmd('nextLine')) |
| 1225 // Ensure nothing is selected when the range covers the entire line. | 1225 // Ensure nothing is selected when the range covers the entire line. |
| 1226 .expectBraille('with a second line', {startIndex: -1, endIndex: -1}) | 1226 .expectBraille('with a second line', {startIndex: -1, endIndex: -1}) |
| 1227 .replay(); | 1227 .replay(); |
| 1228 }); | 1228 }); |
| 1229 }); | 1229 }); |
| OLD | NEW |