| 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_e2e_test_base.js', | 6 GEN_INCLUDE(['../../testing/chromevox_e2e_test_base.js', |
| 7 '../../testing/assert_additions.js']); | 7 '../../testing/assert_additions.js']); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Test fixture for cvox.BrailleTable tests. | 10 * Test fixture for cvox.BrailleTable tests. |
| 11 * This is an E2E test because there's no easy way to load a data file in | 11 * This is an E2E test because there's no easy way to load a data file in |
| 12 * a webui-style test. | 12 * a webui-style test. |
| 13 * @constructor | 13 * @constructor |
| 14 * @extends {ChromeVoxE2ETest} | 14 * @extends {ChromeVoxE2ETest} |
| 15 */ | 15 */ |
| 16 function CvoxBrailleTableTest() {} | 16 function CvoxBrailleTableTest() {} |
| 17 | 17 |
| 18 CvoxBrailleTableTest.prototype = { | 18 CvoxBrailleTableTest.prototype = { |
| 19 __proto__: ChromeVoxE2ETest.prototype, | 19 __proto__: ChromeVoxE2ETest.prototype, |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Tests that {@code getAll} can fetch and parse the tables file. | 23 * Tests that {@code getAll} can fetch and parse the tables file. |
| 24 * NOTE: This will need to be adjusted when more tables are added. | 24 * NOTE: This will need to be adjusted when more tables are added. |
| 25 */ | 25 */ |
| 26 TEST_F('CvoxBrailleTableTest', 'testGetAll', function() { | 26 TEST_F('CvoxBrailleTableTest', 'testGetAll', function() { |
| 27 cvox.BrailleTable.getAll(function(tables) { | 27 cvox.BrailleTable.getAll(function(tables) { |
| 28 assertEquals(60, tables.length); | 28 assertEquals(59, tables.length); |
| 29 assertNotNullNorUndefined( | 29 assertNotNullNorUndefined( |
| 30 cvox.BrailleTable.forId(tables, 'en-US-g1'), | 30 cvox.BrailleTable.forId(tables, 'en-US-g1'), |
| 31 'Can\'t find US English grade 1 table'); | 31 'Can\'t find US English grade 1 table'); |
| 32 testDone(); | 32 testDone(); |
| 33 }); | 33 }); |
| 34 }); | 34 }); |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Tests the getUncontracted function. | 37 * Tests the getUncontracted function. |
| 38 */ | 38 */ |
| 39 TEST_F('CvoxBrailleTableTest', 'testGetUncontracted', function() { | 39 TEST_F('CvoxBrailleTableTest', 'testGetUncontracted', function() { |
| 40 cvox.BrailleTable.getAll(function(tables) { | 40 cvox.BrailleTable.getAll(function(tables) { |
| 41 function assertUncontracted(uncontractedId, idToCheck) { | 41 function assertUncontracted(uncontractedId, idToCheck) { |
| 42 var checkedTable = cvox.BrailleTable.forId(tables, idToCheck); | 42 var checkedTable = cvox.BrailleTable.forId(tables, idToCheck); |
| 43 var uncontractedTable = cvox.BrailleTable.getUncontracted( | 43 var uncontractedTable = cvox.BrailleTable.getUncontracted( |
| 44 tables, checkedTable); | 44 tables, checkedTable); |
| 45 assertNotEquals(null, uncontractedTable); | 45 assertNotEquals(null, uncontractedTable); |
| 46 assertEquals(uncontractedId, uncontractedTable.id); | 46 assertEquals(uncontractedId, uncontractedTable.id); |
| 47 } | 47 } |
| 48 assertUncontracted('en-US-comp8', 'en-US-g2'); | 48 assertUncontracted('en-US-comp8', 'en-US-g2'); |
| 49 assertUncontracted('en-US-comp8', 'en-US-comp8'); | 49 assertUncontracted('en-US-comp8', 'en-US-comp8'); |
| 50 assertUncontracted('nb-comp8', 'nb-g0'); | 50 assertUncontracted('nb-comp8', 'nb-g0'); |
| 51 assertUncontracted('sv-comp8', 'sv-g1'); | 51 assertUncontracted('sv-comp8', 'sv-g1'); |
| 52 assertUncontracted('ar-g1', 'ar-g1'); | 52 assertUncontracted('ar-g1', 'ar-g1'); |
| 53 assertUncontracted('de-comp8', 'de-CH-g2'); | 53 assertUncontracted('de-comp8', 'de-CH-g2'); |
| 54 testDone(); | 54 testDone(); |
| 55 }); | 55 }); |
| 56 }); | 56 }); |
| OLD | NEW |