| 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 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); | 5 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Base class for walker test fixtures. | 8 * Base class for walker test fixtures. |
| 9 * @constructor | 9 * @constructor |
| 10 * @extends {ChromeVoxUnitTestBase} | 10 * @extends {ChromeVoxUnitTestBase} |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 document.body.removeChild(document.body.lastChild); | 32 document.body.removeChild(document.body.lastChild); |
| 33 } | 33 } |
| 34 | 34 |
| 35 this.walker = this.newWalker(); | 35 this.walker = this.newWalker(); |
| 36 }, | 36 }, |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Returns a new walker appropriate for the child test. | 39 * Returns a new walker appropriate for the child test. |
| 40 * @return {!cvox.AbstractWalker} The walker instance. | 40 * @return {!cvox.AbstractWalker} The walker instance. |
| 41 */ | 41 */ |
| 42 newWalker: goog.abstractMethod, | 42 // Closure library is not available when this literal is evaluated, so |
| 43 // we can't use goog.abstractMethod here. |
| 44 newWalker: function() { |
| 45 throw Error('newWalker not implemented.'); |
| 46 }, |
| 43 | 47 |
| 44 /** | 48 /** |
| 45 * Makes testing much less verbose. Executes the command on the | 49 * Makes testing much less verbose. Executes the command on the |
| 46 * selection, then asserts that for all the parameters passed in desc, | 50 * selection, then asserts that for all the parameters passed in desc, |
| 47 * the new selection matches. Returns the new selections if assertion passes. | 51 * the new selection matches. Returns the new selections if assertion passes. |
| 48 * NOTE: If you change the parameters here, you should also change the | 52 * NOTE: If you change the parameters here, you should also change the |
| 49 * whitelist above. | 53 * whitelist above. |
| 50 * @param {!cvox.CursorSelection} sel The selection. | 54 * @param {!cvox.CursorSelection} sel The selection. |
| 51 * @param {!string|!cvox.CursorSelection} opt_cmdOrDest The command to | 55 * @param {!string|!cvox.CursorSelection} opt_cmdOrDest The command to |
| 52 * execute, or the override returned selection. | 56 * execute, or the override returned selection. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 */ | 229 */ |
| 226 TEST_F(testFixture, 'testEmptyBody', function() { | 230 TEST_F(testFixture, 'testEmptyBody', function() { |
| 227 var sel = cvox.CursorSelection.fromBody(); | 231 var sel = cvox.CursorSelection.fromBody(); |
| 228 | 232 |
| 229 // Testing for infinite loop. If one exists, this test will fail by timing | 233 // Testing for infinite loop. If one exists, this test will fail by timing |
| 230 // out. | 234 // out. |
| 231 var sync = this.walker.sync(sel); | 235 var sync = this.walker.sync(sel); |
| 232 var next = this.walker.next(sel); | 236 var next = this.walker.next(sel); |
| 233 }); | 237 }); |
| 234 }; | 238 }; |
| OLD | NEW |