Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/walkers/word_walker_test.unitjs

Issue 563773003: Migrate walker tests from upstream ChromeVox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Fix another test that only fails on the bots. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/walkers/walker_unittest_base.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Include test fixture.
6 GEN_INCLUDE(['walker_unittest_base.js']);
7
8 /**
9 * Test fixture.
10 * @constructor
11 * @extends {CvoxWalkerTestBase}
12 */
13 function CvoxWordWalkerUnitTest() {}
14
15 CvoxWordWalkerUnitTest.prototype = {
16 __proto__: CvoxWalkerUnitTestBase.prototype,
17
18 /** @override */
19 closureModuleDeps: CvoxWalkerUnitTestBase.prototype.closureModuleDeps.concat(
20 'cvox.WordWalker'),
21
22 /** @override */
23 newWalker: function() {
24 return new cvox.WordWalker();
25 },
26
27 /**
28 * Set up for the simple tests so we don't have to repeat.
29 * @private
30 */
31 setUpSimpleHtml_: function() {
32 this.loadDoc(function() {/*!
33 <div id="a"><p id="b">The </p><p id="c">quick brown.</p></div>
34 */});
35 }
36 };
37
38 CvoxWalkerUnitTestBase.addCommonTests('CvoxWordWalkerUnitTest');
39
40 TEST_F('CvoxWordWalkerUnitTest', 'testSimpleForwardSync', function() {
41 this.setUpSimpleHtml_();
42
43 // invalid selection
44 var sel = cvox.CursorSelection.fromNode(document.getElementById('a'));
45 var ret = this.go(sel, 'sync', {
46 selText: 'The ',
47 selParentNodeId: 'b',
48 selStartIndex: 0,
49 selEndIndex: 3,
50 selReversed: false
51 });
52
53 // valid selection
54 var ret2 = this.walker.sync(ret);
55 assertTrue(ret2.equals(ret));
56 });
57
58 TEST_F('CvoxWordWalkerUnitTest', 'testSimpleReversedSync', function() {
59 this.setUpSimpleHtml_();
60
61 // invalid selection
62 var sel = cvox.CursorSelection.fromNode(document.getElementById('a'));
63 sel.setReversed(true);
64 var ret = this.go(sel, 'sync', {
65 selText: 'quick brown.',
66 selParentNodeId: 'c',
67 selStartIndex: 0,
68 selEndIndex: 5,
69 selReversed: true
70 });
71
72 // valid selection
73 var ret2 = this.walker.sync(ret);
74 assertTrue(ret2.equals(ret));
75 });
76
77 TEST_F('CvoxWordWalkerUnitTest', 'testSimpleForwardNext', function() {
78 this.setUpSimpleHtml_();
79
80 var sel = cvox.CursorSelection.fromNode(document.getElementById('a'));
81 sel = this.walker.sync(sel);
82 var ret = this.go(sel, 'next', {
83 selText: 'quick brown.',
84 selParentNodeId: 'c',
85 selStartIndex: 0,
86 selEndIndex: 5,
87 selReversed: false
88 });
89 });
90
91 TEST_F('CvoxWordWalkerUnitTest', 'testSimpleReversedNext', function() {
92 this.setUpSimpleHtml_();
93
94 var sel = cvox.CursorSelection.fromNode(document.getElementById('a'));
95 sel = this.walker.sync(sel.setReversed(true));
96 var ret = this.go(sel, 'next', {
97 selText: 'The ',
98 selParentNodeId: 'b',
99 selStartIndex: 0,
100 selEndIndex: 3,
101 selReversed: true
102 });
103 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/walkers/walker_unittest_base.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698