Chromium Code Reviews| Index: chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table_test.extjs |
| diff --git a/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table_test.extjs b/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table_test.extjs |
| index b81c9e70d5fb36fc77682239a1dd66cde3b59f79..7afd2f0db876ac03805127b0aa08c097db464206 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table_test.extjs |
| +++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table_test.extjs |
| @@ -23,12 +23,31 @@ CvoxBrailleTableTest.prototype = { |
| * Tests that {@code getAll} can fetch and parse the tables file. |
| * NOTE: This will need to be adjusted when more tables are added. |
| */ |
| -TEST_F('CvoxBrailleTableTest', 'testGetAll', function() { |
| +TEST_F('CvoxBrailleTableTest', 'testGetAllAndValidate', function() { |
| cvox.BrailleTable.getAll(function(tables) { |
| - assertEquals(59, tables.length); |
| + expectEquals(68, tables.length); |
| assertNotNullNorUndefined( |
| cvox.BrailleTable.forId(tables, 'en-US-g1'), |
| 'Can\'t find US English grade 1 table'); |
| + for (var i = 0, table; table = tables[i]; ++i) { |
| + expectEquals('string', typeof table.id); |
| + expectTrue(table.dots === '6' || table.dots === '8'); |
| + expectTrue(cvox.BrailleTable.getDisplayName(table).length > 0); |
|
David Tseng
2014/09/23 17:41:49
Ok; here's the test.
|
| + } |
| + testDone(); |
| + }); |
| +}); |
| + |
| +/** Tests getDisplayName for some specific representative cases. */ |
| +TEST_F('CvoxBrailleTableTest', 'testGetDisplayName', function() { |
| + cvox.BrailleTable.getAll(function(tables) { |
| + var table = cvox.BrailleTable.forId(tables, 'bg-comp8'); |
| + expectEquals('Bulgarian', cvox.BrailleTable.getDisplayName(table)); |
| + table = cvox.BrailleTable.forId(tables, 'ar-g1'); |
| + expectEquals('Arabic, Grade 1', cvox.BrailleTable.getDisplayName(table)); |
| + table = cvox.BrailleTable.forId(tables, 'en-UEB-g1'); |
| + expectEquals('English (UEB), Grade 1', |
| + cvox.BrailleTable.getDisplayName(table)); |
| testDone(); |
| }); |
| }); |
| @@ -38,19 +57,19 @@ TEST_F('CvoxBrailleTableTest', 'testGetAll', function() { |
| */ |
| TEST_F('CvoxBrailleTableTest', 'testGetUncontracted', function() { |
| cvox.BrailleTable.getAll(function(tables) { |
| - function assertUncontracted(uncontractedId, idToCheck) { |
| + function expectUncontracted(uncontractedId, idToCheck) { |
| var checkedTable = cvox.BrailleTable.forId(tables, idToCheck); |
| var uncontractedTable = cvox.BrailleTable.getUncontracted( |
| tables, checkedTable); |
| - assertNotEquals(null, uncontractedTable); |
| - assertEquals(uncontractedId, uncontractedTable.id); |
| + expectNotEquals(null, uncontractedTable); |
| + expectEquals(uncontractedId, uncontractedTable.id); |
| } |
| - assertUncontracted('en-US-comp8', 'en-US-g2'); |
| - assertUncontracted('en-US-comp8', 'en-US-comp8'); |
| - assertUncontracted('nb-comp8', 'nb-g0'); |
| - assertUncontracted('sv-comp8', 'sv-g1'); |
| - assertUncontracted('ar-g1', 'ar-g1'); |
| - assertUncontracted('de-comp8', 'de-CH-g2'); |
| + expectUncontracted('en-US-comp8', 'en-US-g2'); |
| + expectUncontracted('en-US-comp8', 'en-US-comp8'); |
| + expectUncontracted('nb-comp8', 'nb-g0'); |
| + expectUncontracted('sv-comp8', 'sv-g1'); |
| + expectUncontracted('ar-g1', 'ar-g1'); |
| + expectUncontracted('de-comp8', 'de-CH-g2'); |
| testDone(); |
| }); |
| }); |