| 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_unittest_base.js']); | 6 GEN_INCLUDE(['../testing/chromevox_unittest_base.js']); |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Test fixture. | 9 * Test fixture. |
| 10 * @constructor | 10 * @constructor |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 assertEquals('jump_commands', categories[6]); | 34 assertEquals('jump_commands', categories[6]); |
| 35 assertEquals('tables', categories[7]); | 35 assertEquals('tables', categories[7]); |
| 36 | 36 |
| 37 assertEquals('stop_speech_key', | 37 assertEquals('stop_speech_key', |
| 38 cvox.CommandStore.messageForCommand('stopSpeech')); | 38 cvox.CommandStore.messageForCommand('stopSpeech')); |
| 39 assertEquals('controlling_speech', | 39 assertEquals('controlling_speech', |
| 40 cvox.CommandStore.categoryForCommand('stopSpeech')); | 40 cvox.CommandStore.categoryForCommand('stopSpeech')); |
| 41 | 41 |
| 42 var controllingSpeechCmds = | 42 var controllingSpeechCmds = |
| 43 cvox.CommandStore.commandsForCategory('controlling_speech'); | 43 cvox.CommandStore.commandsForCategory('controlling_speech'); |
| 44 assertEquals(11, controllingSpeechCmds.length); | 44 assertEquals(10, controllingSpeechCmds.length); |
| 45 assertEquals('stopSpeech', controllingSpeechCmds[0]); | 45 assertEquals('stopSpeech', controllingSpeechCmds[0]); |
| 46 assertEquals('toggleChromeVox', controllingSpeechCmds[1]); | 46 assertEquals('decreaseTtsRate', controllingSpeechCmds[1]); |
| 47 assertEquals('decreaseTtsRate', controllingSpeechCmds[2]); | 47 assertEquals('increaseTtsRate', controllingSpeechCmds[2]); |
| 48 assertEquals('increaseTtsRate', controllingSpeechCmds[3]); | 48 assertEquals('decreaseTtsPitch', controllingSpeechCmds[3]); |
| 49 assertEquals('decreaseTtsPitch', controllingSpeechCmds[4]); | 49 assertEquals('increaseTtsPitch', controllingSpeechCmds[4]); |
| 50 assertEquals('increaseTtsPitch', controllingSpeechCmds[5]); | |
| 51 }); | 50 }); |
| 52 | 51 |
| 53 | 52 |
| 54 /** Tests that undefined is returned for bad queries. */ | 53 /** Tests that undefined is returned for bad queries. */ |
| 55 TEST_F('CvoxCommandStoreUnitTest', 'InvalidQueries', function() { | 54 TEST_F('CvoxCommandStoreUnitTest', 'InvalidQueries', function() { |
| 56 assertThat(cvox.CommandStore.commandsForCategory('foo'), eqJSON([])); | 55 assertThat(cvox.CommandStore.commandsForCategory('foo'), eqJSON([])); |
| 57 assertTrue(undefined == cvox.CommandStore.categoryForCommand('foo')); | 56 assertTrue(undefined == cvox.CommandStore.categoryForCommand('foo')); |
| 58 assertTrue(undefined == cvox.CommandStore.messageForCommand('foo')); | 57 assertTrue(undefined == cvox.CommandStore.messageForCommand('foo')); |
| 59 }); | 58 }); |
| 60 | 59 |
| 61 | 60 |
| 62 /** Tests the validity of every command. */ | 61 /** Tests the validity of every command. */ |
| 63 TEST_F('CvoxCommandStoreUnitTest', 'CommandValidity', function() { | 62 TEST_F('CvoxCommandStoreUnitTest', 'CommandValidity', function() { |
| 64 var categories = cvox.CommandStore.categories(); | 63 var categories = cvox.CommandStore.categories(); |
| 65 for (var i = 0; i < categories.length; i++) { | 64 for (var i = 0; i < categories.length; i++) { |
| 66 var commands = cvox.CommandStore.commandsForCategory(categories[i]); | 65 var commands = cvox.CommandStore.commandsForCategory(categories[i]); |
| 67 for (j = 0; j < commands.length; j++) { | 66 for (j = 0; j < commands.length; j++) { |
| 68 var command = commands[j]; | 67 var command = commands[j]; |
| 69 assertEquals(command + ' function', | 68 assertEquals(command + ' function', |
| 70 command + ' ' + typeof(cvox.ChromeVoxUserCommands.commands[command])); | 69 command + ' ' + typeof(cvox.ChromeVoxUserCommands.commands[command])); |
| 71 } | 70 } |
| 72 } | 71 } |
| 73 }); | 72 }); |
| OLD | NEW |