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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..435bc9d667c3242fab68b940a1c207b231e66332 |
| --- /dev/null |
| +++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/braille_table_test.extjs |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Include test fixture. |
| +GEN_INCLUDE(['../../testing/chromevox_e2e_test_base.js', |
| + '../../testing/assert_additions.js']); |
| + |
| +/** |
| + * Test fixture for cvox.BrailleTable tests. |
| + * This is an E2E test because there's no easy way to load a data file in |
| + * a webui-style test. |
|
David Tseng
2014/09/08 21:45:59
Is this a new test? Would be helpful to separate o
|
| + * @constructor |
| + * @extends {ChromeVoxE2ETest} |
| + */ |
| +function CvoxBrailleTableTest() {} |
| + |
| +CvoxBrailleTableTest.prototype = { |
| + __proto__: ChromeVoxE2ETest.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() { |
| + cvox.BrailleTable.getAll(function(tables) { |
| + assertEquals(60, tables.length); |
|
David Tseng
2014/09/08 21:45:59
Define as a constant above in the class constructo
|
| + assertNotNullNorUndefined( |
| + cvox.BrailleTable.forId(tables, 'en-US-g1'), |
| + 'Can\'t find US English grade 1 table'); |
| + testDone(); |
| + }); |
| +}); |
| + |
| +/** |
| + * Tests the getUncontracted function. |
| + */ |
| +TEST_F('CvoxBrailleTableTest', 'testGetUncontracted', function() { |
| + cvox.BrailleTable.getAll(function(tables) { |
| + function assertUncontracted(uncontractedId, idToCheck) { |
| + var checkedTable = cvox.BrailleTable.forId(tables, idToCheck); |
| + var uncontractedTable = cvox.BrailleTable.getUncontracted( |
| + tables, checkedTable); |
| + assertNotEquals(null, uncontractedTable); |
|
David Tseng
2014/09/08 21:45:59
assertNotNull? (if it exists).
|
| + assertEquals(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'); |
| + testDone(); |
| + }); |
| +}); |